Fork me on GitHub
#fulcro
<
2019-11-28
>
tianshu14:11:05

If I have a Sidebar for navigation, current activate route link will be highlight. what :query should I use for this Sidebar. I want make sure it will re-rendered whenever route changes. what confusing me is my Root contains the RootRouter, however, when route changes, the Root will not re-render(test by log). so I don't know how to trigger the re-render for the Sidebar.

tianshu15:11:28

Ohh, I think I can make the root re-render by query ::dr/id, don't know if it's the correct way.

tianshu08:11:34

which data should I query in this link query, should I query ::dr/id in the sidebar?

tony.kay20:11:07

If you try to understand the mechanism of query and refresh, it becomes very simple. Data retrieval and refresh for the UI is all tied to the query. A link/ident query gets you to a targeted place in the database (instead of relative in the graph). From there, you query for what you need to render. The rendering system uses the query and idents to figure out which components are interested in updates. It really isn’t complicated, it’s just different (since most systems are not truly data-driven all the way through).

tianshu02:11:30

Thanks for explain in detail! This make sense.

Thomas Moerman15:11:16

Q: I'm getting a bit of a strange error, working on a component that uses a recursive query:

Uncaught Error: ... is not ISeqable
    at Object.cljs$core$seq [as seq] (core.cljs:1226)
    at Function.cljs$core$IFn$_invoke$arity$3 (core.cljs:2464)
    at Function.cljs$core$IFn$_invoke$arity$3 (core.cljs:2551)
    at Object.cljs$core$group_by [as group_by] (core.cljs:10834)
    at fulcro$client$primitives$denormalize_STAR_ (primitives.cljc:1298)
    at primitives.cljc:1276
    at Function.G__68373__2 [as cljs$core$IFn$_invoke$arity$2] (core.cljs:4706)
    at core.cljs:5631
    at core.cljs:5631
    at Object.cljs$core$IReduce$_reduce$arity$3 (core.cljs:5635)

tony.kay17:11:51

Quoting. is a symbol, and also make sure it is in the correct position syntactically.

Thomas Moerman17:11:21

I think I found it: the recursive query starting from a hard-coded link query pointing to a DB entry that doesn't exist yet at page render, but is loaded in later. So not a Fulcro bug, but (as expected) as SNAFU from my part :face_with_rolling_eyes:😏

Thomas Moerman17:11:04

fixing the hard-coded part made error disappear

Thomas Moerman15:11:25

Does this ring any bells?

Thomas Moerman15:11:44

the app keeps working though

Thomas Moerman15:11:11

(Fulcro 2.8.11)