This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-02
Channels
- # aleph (1)
- # announcements (1)
- # babashka (4)
- # beginners (89)
- # calva (3)
- # chlorine-clover (18)
- # cider (33)
- # clj-kondo (27)
- # cljdoc (4)
- # cljsrn (2)
- # clojure (248)
- # clojure-europe (7)
- # clojure-italy (15)
- # clojure-nl (7)
- # clojure-norway (10)
- # clojure-poland (1)
- # clojure-spec (12)
- # clojure-sweden (5)
- # clojure-uk (57)
- # clojured (4)
- # clojuredesign-podcast (1)
- # clojurescript (55)
- # core-async (14)
- # core-logic (3)
- # cursive (10)
- # datomic (38)
- # figwheel-main (8)
- # fulcro (23)
- # graalvm (126)
- # hoplon (59)
- # jobs (1)
- # kaocha (3)
- # malli (30)
- # meander (17)
- # off-topic (32)
- # pathom (19)
- # pedestal (4)
- # re-frame (12)
- # reagent (2)
- # reitit (3)
- # shadow-cljs (81)
- # sql (9)
- # tools-deps (34)
- # vim (20)
- # vscode (7)
- # xtdb (5)
<@U0CKQ19AQ> Does it make sense for `dr/route-immediate / dr/route-deferred` to ever use different ident than the one of the component in whose `:will-enter` they are used? If they always use the ident of the component they are nested under, would it make sense to log a warning when those two do not match? I'd be happy to try to make a PR for it. (I guess that we could set a dynamic var `*ident*` to `(get-ident class {})` which would return `[:some/id nil]` and then use it inside the route-* functions to check that `(= (first ident) (first *ident*))` (and perhaps also compare seconds, if not nil)? If sending empty props is too hackish, we could modify `build-ident` to add metadata to the ident functions such as `{::ident-table <kwd>}` for keyword and template idents and check at least these two, in there is no good way to check a method ident.)
@holyjak You are welcome to try, but I’m not sure you’ll be able to know the correct props. A component with an ident derived from props has no specific tie to those props until it’s mounted, and it never will be mounted if you don’t give it the right ident to mount.
True, that's why I would send in empty props. I don't really care about the dynamic part of the ident for there is no way to check that, only the table name matters (the second element of the ident vector matters and can be checked if it is static). So (get-ident class {})
would be usable, no?
sorry, I didn’t read your text fully. and yes, a PR that adds useful debug messages is great.
Oh, and there is another sanity check you could do. You do know where the thing is supposed to be, so you could pull the map of data from there and pass it to ident
and see if it returns the full thing. If you did that on target-ready (since they may not be there until then) then you could indicate something about the props not being as expected.
☝️ you mean in addition or instead of the checks in route-deferred/immediate? It is better because it can see the props but it I assume does not know whether it has been defined inside :will-enter
and that it indeed was defined inside route-deferred/immediate?
Here is a proof of concept https://github.com/fulcrologic/fulcro/pull/377 Any early feedback? I also need to look into the check in target-ready.
@tony.kay I am unsure how to do what you propose. In target-ready I have indeed the expected target
ident but how to verify that it actually corresponds to some mounted component (which what you proposed, I believe)? Where to get the props for comp/ident? But I can verify that (not (nil? (comp/ident->any app target)))
?
you can get the state-map from the app, and the props from that via the proposed ident, no?
(get-in (app/current-state app) target)
is the props. Pass that to (comp/ident class props)
and see if you get back the target ident
if not, they gave you an ident that didn’t resolve to data that can possibly generate that ident, meaning something is wrong
ok, didn't know the state map can give me the props, thx!
it’s shallow, right? It’s the normalized db, so get-in gives you the normalized component, but ID is always in that, by definition
OMG, of course. I am still getting used to Fulcro :-)
yep…it’s funny, as you go this kind of thing will happen to you a lot: you’ll think the thing you want to do is going to be hard, then you’ll get in there and go “Oh, right, I have this and that, and the data is normalized…done”
@tony.kay I have updated the PR, please let me know whether you have any further comments, when you have time. Thank you!
It looks like the Chrome extensions store accepted the new version of Inspect. This means the db explorer should be available generally now!