This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-28
Channels
- # aleph (1)
- # announcements (16)
- # bangalore-clj (1)
- # beginners (78)
- # cider (109)
- # clara (3)
- # cljdoc (6)
- # cljsjs (3)
- # clojure (209)
- # clojure-dev (11)
- # clojure-europe (1)
- # clojure-france (9)
- # clojure-italy (13)
- # clojure-nl (3)
- # clojure-spain (2)
- # clojure-spec (19)
- # clojure-uk (50)
- # clojurescript (41)
- # clojutre (2)
- # core-async (45)
- # cursive (2)
- # datomic (14)
- # emacs (6)
- # figwheel-main (1)
- # fulcro (101)
- # graalvm (1)
- # graphql (3)
- # jobs-discuss (3)
- # kaocha (12)
- # leiningen (8)
- # music (4)
- # off-topic (47)
- # parinfer (8)
- # pathom (17)
- # pedestal (53)
- # re-frame (47)
- # reagent (22)
- # reitit (4)
- # shadow-cljs (49)
- # tools-deps (87)
Hi, where can I find the porting tool to migrate from fulcro 2 to 3?
There is none. But there is a guide: https://github.com/fulcrologic/fulcro/blob/develop/PORTING-FROM-2.x.adoc
I’m pretty sure i’ve seen some messages about a tool.
This is what I found in a slack archive:
The repo doesn’t exist anymore though
Hi @U4X0SB0HX, on the porting tool: frankly, I ran out of steam and just started porting things by hand. I didn’t want “support” requests, so I took down the repo.
I have too many demands on my time, I spent about 20+ hours on the tool, and it still wasn’t working well…and I didn’t want many more hours of “the porting tool did X” messages here 😜
Completely understandable!
If you’re interested in finishing it, and publishing it under your own account (so you can deal with issues), I’m glad to provide the source
I already started doing it by hand, so I’m fine thanks!
ReactNative isnt supported by fulcro But it works Here a working demo with ~200 LOC https://github.com/souenzzo/graph-demo/tree/91eb9ccb1a61697a57ff42e5e5d16f3bcfa4741f
Main trick is here https://github.com/souenzzo/graph-demo/blob/91eb9ccb1a61697a57ff42e5e5d16f3bcfa4741f/src/main/souenzzo/graph_demo/client.cljc#L178 There is also demos from #shadow-cljs https://github.com/thheller/fulcro-expo
@tony.kay I also ran into defered-route not working, which turned out to be because i didn't do a get-initial-state of my TopRouter. The example in 14.7 doesn't, which I found missleading:
:initial-state {:root/router {}}
do fulcro support something like (for [i (range 10)] ^{:key idx} (my-component-without-args))
(fulcro2 ATM)
@maxt Yes, I reviewed the dr code…it is doing the “right thing” for initial state, assuming you also do the right thing 🙂
with the new ident-based optimized render in f3, does every component need to have an ident? getting a warning that my root component queries for state that changes, but does not have an ident. getting that warning both with and without an ident on my root component. all my root is doing is pulling in state from children via joins
do have a follow up question, tho: in my client-did-mount
hook, I have a post-mutation
on a load
call that routes the user to the correct screen. it doesn’t seem to be working with the dynamic router – it’s telling me that the route I’m trying to switch to isn’t installed. I assume that’s because the app hasn’t rendered yet or something is wonky with the instantiation order vs fulcro 2. how are people handling initial routing combined with loading/mounting?
You should generally run a change-route
on client-did-mount as a first operation. There is an initialize!
function in dr that you can try as well (it starts all of the router state machines), but I meant for an initial change-route
to do the necessary work. I admit I’m a little unclear what I was thinking with initialize!
.
would any weirdness happen in your opinion if that change-route
call happens inside of a load post mutation?
so in F3 all transactions go into a queue…the intention being that such things that were a problem in f2 won’t be in f3
It you call initialize!
, that starts them all at once…and it might be necessary to do that for your case, which might explain why I wrote it 😜
So, if you look in Fulcro Inspect: there is a table that has the name ::uism/asm-id
. each router will appear in there.
If you don’t see the router in the router table, then you didn’t get it’s state in initial state
fantastic, thanks for the help. just filed a change for the dynamic router book example to compose the initial state correctly into root
Beta 10 is on clojars. Fixes an issue where hot code reload causes a re-mount of DOM nodes at the react level (which re-runs componentDidMount, etc.)
@mss this is a common misunderstanding. The book was actually right. See http://book.fulcrologic.com/fulcro3/#_initial_state I’m guessing you were using a lambda form in your code, which is not “magical”…the non-lambda form is a bit magical.
In hindsight, making the initial state key “magical” might not have been the best move for user clarity…it gets lost in the documentation
Is there a convention when to add a bang (!) to a mutation? Noticed it in the template (`signup!`)
@mroerni I’m trying my best to follow the Clojure convention. If it side-effect (isn’t ref. transparent) then it should have one…I make exceptions for logging, since they are technically side-effects, but don’t affect the referential transparency in a meaningful way
@tony.kay @mroerni I think from the mutation point of view its arguable, given that all mutations are expected to change the world in some way, wouldn't !
be redundant?
@wilkerlucio actually that is a good point, and I rarely include !
on those…and the naming convention for mutation helpers is a suffix of *
…though for the most part the helpers are pure
I admit to being a little inconsistent at times…lots of things to keep track of in lib design and examples
yeah, on my side I don't use !
on mutations
First thought was that this was because signup!
is mutating the state in the backend.
So reloading the page would (maybe) yield a different state now.
Toggling a dropdown on the other hand would not have an impact.
Saying that: mutations should not have bang, following Clojure convention.
The transact!
does the state change while calling a mutation has no side effect per se.
Hi, noob question, I am following the getting started on the Fulcro 3 book and can´t make the code reload when I alter the client.cljs file (it reloads if I change then shadow-cljs.edn file). I was just trying to alter the text on the div.
Yes, by clicking on the button on http://localhost:9630/build/main
@UBEQ9K406 which version? beta-8 (or 9) made some changes to hot code reload, there could be a regression. Try beta 6 or 7…does that work?
It could be a mistake in my instructions, or some missed config on your part…cannot diagnose without seeing the source of the project
One important thing to note is that I am using docker with a mapped folder (though I don't think that is the case because the reload triggers when I change the shadow-cljs.edn file).
It is the first time I am using shadow-cljs, fulcro and tools.deps, so it is quite probable I did something wrong in the configurations.
hot code reload relies on 2 things: - shadow detects change, compiles, pushes new code - Shadow invokes a function to re-mount the fulcro app
you can look at Chrome dev console to see that code was pushed (regular network tab)
The shadow config looks like this (from template): https://github.com/fulcrologic/fulcro-template/blob/master/shadow-cljs.edn#L13
https://github.com/fulcrologic/fulcro-template/blob/master/src/main/app/client.cljs#L16
I am 99% sure that it is a docker problem. In the end I solved by using a file watcher specific for docker. https://github.com/zippoxer/docker-windows-volume-watcher
any suggestions on how to debug nil passed to get-query
? trying to find where from root I might be missing something that’s composing in nil, but I can’t seem to find it at first glance
@mss There is some chance that is a loading issue. The new code attempts to look up components in the registry. I think there might be cases where hot code reload order could cause problems…just guessing
in terms of your question: how to debug. Look at the stack trace…you have source maps, so I would hope that the offending call to get-query would be in it
unfortunately the offending call isn’t in the stack trace beyond a mention of the dynamic-routing/initialize!
call but since my views are composed top-down it could be almost anywhere in my app afaict
so, the way dyn routers work @mss, is they scan the query for all of the routers, which means that your entire tree of get-query is going to be called. The thing is, you certainly don’t call (get-query nil)
yourself, which means that some class you did list didn’t have its query configured (yet?). Check for mis-spellings of :query in your component options.
As far as “debugging” it: you could clone fulcro and add it as a local/root dependency, and then add log/spy
around various expressions called in initialize!
to see where it is going wrong.
technically, local source will be scanned first, so you could just copy over dynamic-routing ns, put it in the right package, and edit it locally that way
I should also add some logging around get-query
that might help it be more revealing…looking at that now