Clojurians
# om

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

molstt 22:24:50

It seems like the support for [:foo _] refs is limited when it comes to automatic re-rendering. Maybe someone could confirm this? I currently can't get my components re-render without switching to supplying plain keys instead (which currently doesn't fit my very flat data model)..

anmonteiro 23:01:38

@molstt not sure I understand. you want to add :foo to transact!, not [:foo _]

molstt 23:12:31

@anmonteiro I wanted to use [:foo _] everywhere, both in component queries and when transacting (if needed to trigger re-render), because I currently have a simplistic model with just a few singletons right under the state root. But if I do that I get no re-renders when data is transacted to these singletons.

anmonteiro 23:14:04

@molstt that’s right, because IIRC transact! won’t recognize links

anmonteiro 23:14:35

this is for a reason: a [:foo _] link refers to a :foo key at the top-level

anmonteiro 23:15:09

so the root component might declare :foo in its query, while another down the tree will query for [:foo _]

molstt 23:21:49

does that mean that components querying via links should re-render automatically when these singletons get new values? Otherwise I don't see how links can work at all..

molstt 23:25:40

I suppose that when I query for :foo in a transaction, 'this' will be used so that the key is considered component-relative

anmonteiro 23:34:08

@molstt yeah the indexer knows which components query for those links

anmonteiro 23:34:24

so if :foo changes, every component that queries for [:foo _] will be scheduled to re-render

molstt 23:38:31

ok, so it should work, that was what I was expecting.. then I probably have some problem in my code

molstt 23:38:57

thanks for info

anmonteiro 23:40:31

@molstt happy to look at a minimal repro in case you can’t figure it out

anmonteiro 23:40:47

first probably make sure that you’re composing queries correctly

molstt 23:41:40

yup, thanks