This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-24
Channels
- # announcements (11)
- # beginners (72)
- # calva (11)
- # cider (12)
- # clj-kondo (147)
- # clojure (6)
- # clojure-new-zealand (2)
- # clojuredesign-podcast (2)
- # clojurescript (36)
- # cursive (2)
- # datomic (5)
- # emacs (4)
- # fulcro (57)
- # graalvm (104)
- # graphql (2)
- # jobs (1)
- # joker (1)
- # kaocha (3)
- # malli (51)
- # off-topic (2)
- # portkey (1)
- # reagent (18)
- # shadow-cljs (26)
- # spacemacs (7)
- # tools-deps (5)
- # vim (4)
@geraldodev no examples that I know of, but it was very easy to get going using https://github.com/fulcrologic/fulcro-websockets . The Readme has pretty good instructions - give it a try, and if you have any problems, I’m sure someone here can help.
I went down an unfortunate rabbit hole today. So maybe this will be useful to someone. Setting up a new project, I added fulcro-spec
as per the fulcro-template
(which happens to use kaocha
, but does not include :reporter [fulcro-spec.reporters.terminal/fulcro-report]
in the tests.edn
config. I totally missed that in the fulcro-spec README until after I figured out the issue.
The problem is, everything seemed to work except for pretty-printing of large diffs. Which meant I went down a rabbit hole of figuring out what is wrong with my kaocha config. In reality, it's this bit of code:
(defn assertion-type
"Given a clojure.test event, return the first symbol in the expression inside (is)."
[m]
(if-let [s (and (seq? (:expected m)) (seq (:expected m)))]
(first s)
:default))
kaocha expects an event with {:expected '(= foo bar)}
but fulcro-spec is in fact generating something akin to {:expected 'foo}
, which is then defaulting to an unknown reporter that tries it's best to pr-str
whatever was :expected and :actual. In fact, just requiring fulcro-spec
macros is enough to break the build, even if I use regular deftest/is
in the code. I'm not even sure if this is an oversight and can be easily addressed in fulcro-spec or if this would require lots of work and breaking changes. Either way, it's a cautionary tale.Turns out there are some related issues: • https://github.com/lambdaisland/kaocha/issues/15 • https://github.com/fulcrologic/fulcro-spec/issues/10
Thanks for describing that…sounds like an easy fix. Open an issue when this info and we’ll have a look
Done. Thanks for all the lovely work. RAD is exciting. 🙂 https://github.com/fulcrologic/fulcro-spec/issues/13 https://github.com/fulcrologic/fulcro-template/pull/9
@tony.kay Just saw the RAD video! Here’s a spitball thought thread. I spent the weekend looking around the ecosystem for new and old ideas. I discovered Duct. Now I spent 2 days with duct and 10mins with your video, so I definitely don’t know everything about everything. But here a little thought:
Very light summary of duct
Basically Duct aims to declare your system (mainly back-end) with data. It’s a framework that generates Integrant systems, and comes with some pre-fab modules for the basic needs. The one thing I like is that the maker of Duct differentiate’s between modules and components, where a component is what you’d expect (a router, db, webserver), but a module can generate and manipulate the entire config.
For example, let’s say it’s 2009 (oh 2009 <3) and you’re writing a rest crud app. You could write out every route for a given resource, or you could just include a rest module that merges in REST routes for a given resource and connects them to handler dispatch keys following a convention. That module is also configurable. More magic, less control, but it’s magic on demand like you said in the video for those places where it’s just fine.
RAD
I think it seemed very open to change, but every attr is wrapped in a macro defattr
. Macro’s are less composable than data. It’s harder to generate macro’s without generating a code file or knowing about the macro’s internals. Do you think it’s possible to have RAD be expanded from a datastructure instead of macros? That way other libraries, people, could hook into that part as well, and even generate RAD schema’s based on other inputs etc..
So defattr
just registers the attribute for you…it just defs a map otherwise, so the answer there is “yes, easily”
you could collect them all up into a schema map, and then call a funciton to build the system
Of course not, that’s why I’m intervening so annoyingly
But that’s great!
If that’s the case, this could be huge imo
One goal is great error messages, so I sometimes lean on macros because they can give you immediate feedback when you screw up and good error messages
ah i see
My defsc macro just calls configure-component!
, but it checks things like “did you destructure something in props you didn’t query for”
why would macros provide better errors?
gotcha
Macros are compiler extensions…compile errors are useful in many cases where static analysis can tell you abt problems
core async isn’t even possible (as designed) without macros that convert clojure into state machines…they pre-compile your clojure into different clojure
I realised I could’ve summarized my shpiel by could rad be data driven instead of macro driven haha
exiting stuff @tony.kay! Have fun at the conj 🙂
conj just ended…headed out today. RAD is data-driven…but I agree with your point, perhaps macros are not right in the data model at all
RAD is 4 days of conference-driven development…design work was not in any way careful 😜
I've started to enjoy mount that I discovered via fulcro template. It's way less complexity than component and yet a library. One can adopt (like I did) or go for other library or framework (like duct). It is a lovely choice because it reduces the complexity.
I just did a meet-up about where Fulcro is going, for contributors…here are the slides if anyone wants to help: http://book.fulcrologic.com/Fulcro-needs.pdf
just start to study fulcro via the video tutorial on youtube. this is really awesome.
There are a couple of options. AFAIK the dynamic router works for all situations however: http://book.fulcrologic.com/fulcro3/#_dynamic_router
I'm building out a simple poker game. My application has a Deck
component. My understanding is that I'll only need a single :deck/id
on which I will run mutations throughout the game. As cards are dealt out and collected back, :deck/cards
gets updated to represent the change. Does that sound right? Is there any technical case where I should be create a new :deck/id
and working with that instead of the original [:deck/id 1]
?
Yes that sounds fine. No, a singleton will be fine. If your card game later requires multiple decks then change things then. You won't have incurred any technical debt by going with a singleton. Also in your application 'panels' will be singletons. The only things not to be singletons are obvious 'many-s', such as cards.
@alex.sheluchin as what I learn from the video tutorial of fulcro, If you have some singleton component, you can give it a constant :ident
, by provide a lambda:
:ident (fn [_ _] [:component/id ::name-of-this-component])
looks something like this.Does a singleton make sense? Is it the right abstraction? I guess I'm dealing with a conceptual conflict between data being immutable and maintaining the same id while creating a mutated copy.
the copy should have a different ident
have you looked at how form state support is implemented?
when editing an entity in a form, it makes a pristine copy (in a different location), if you cancel out of the form it reverts the entity using the pristine version
you can use the inspector tool to see how it’s done in this demo http://book.fulcrologic.com/#_form_state_demos
the copy should have a different identWhen you edit a phone number in the form state demo, it changes the properties on the same [:phone/id 1]
ident; it doesn't create a new ident with the new details.
I haven't read that far into the docs yet, I'm guessing it explains it later. I'll check out the sections you linked.
My main question is this: if I have a [:deck/id 1]
ident, and within that there is a :deck/cards
, and I remove a single card from that deck, does the resulting deck (same as 1, less one card) need a new ident? Does it become [:deck/id 2]
with one less item in :deck/cards
, or do I just update deck 1?
I asked the same question here: https://clojurians.slack.com/archives/C68M60S4F/p1574626970497600?thread_ts=1574607533.487300&cid=C68M60S4F and I'm getting a little mixed up between your answer and @U0D5RN0S1's
No it doesn't need a new ident. [:deck/id 1]
is your deck of cards. [:deck/id 1 :deck/cards]
is the location where the cards are kept in that deck. If you remove the joker then that location will have one less card, one less ident. Actually copying state is something you are unlikely to be needing to do in your first experimental application. If you had another deck of cards it would be [:deck/id 2]
and would have its own set of idents. You might for example move [card/id :black-joker]
from location [:deck/id 1 :deck/cards]
to [:player/id 1 :deck/cards]
.
@alex.sheluchin if you only have [:deck/id 1]
, you just ensure this ident is unique, IMO
Hello, I have noticed that entity->pristine*
stopped working from version 3.0.2 to 3.0.3 (it works like expected in all versions prior to 3.0.2). This can be tested using video example under tag rendering-part-2
.
@U0MK9B06T can you please file a github issue with steps to reproduce, expect outcome and actual outcome?
When pressing : on query tab on fulcro inspect chrome brings the settings. Are you experiencing this too ? Do you know a way to disable this shortcut ?
I just checked and I do not see this behavior
i’m on a mac, might be something specific to your setup
@U09FEH8GN Thank you. I'm on linux