I'm trying to use :shared-fn to share the current user across all components. Problem is, it isn't updated on login/logout without a refresh. Is there a way to 'refresh' the reconciler?
Login and logout are the only times when this is a problem, but i'd rather not trigger a page reload if I can avoid it.
Found it! https://github.com/omcljs/om/blob/master/src/main/om/next.cljc#L2809
Doesn't seem to work 😞 I'm trying to call it in componentDidUpdate of my Wrapper component if the user props change..
It does go through my :shared-fn.
It seems like force-root-render!
does not force re-rendering every component, it still diffs the props. This seemed to be the problem earlier ^^, I was looking for a method of refreshing the entire UI tree.
It is alraedy built-in
that is what :ui/react-key
on the root is for
you have to change the key on the root element, or React won't really re-render everything
oh, sorry, that comment was an untangled-ism, but the fact is true for React in general
If the React key changes on an element, then React doesn't even look at diffs: it just re-renders the whole UI (sub)tree
For your use-case, you might want to use a link query instead of shared
cause that way you could trigger re-renders on components that ask for that "root" data
through the normal Om mechanisms