I have some really strange bug already from the morning (it's 5 PM now for me) and I just can't figure it out.
Basically I have an atom. It's nil, I click the button, it gets updated and I check it's value via console.log. All just as expected. Except that my components are not updating:
(when @financial-year-end-value [day-select])
This will either never render and all regardless of the value of the atom OR it will always render (again, regardless of the value of the atom).
Additionally I have
[:p (str "FYEV: " @financial-year-end-value)]
This never updates either (although the atom is updating, I can see it in the JS console). And it's not updating twice, I'd see another log statement with the new value.
What's going on? What could change a component to not update?This actually happens with another component exactly the same thing. I don't know what code to post, nothing feels related and there's a lot of code.
After a day wasted, I found the issue: disabling React strict mode did the trick. Blimey...
Strict mode should not interfere with atom changes. All it does is render your components twice to ensure your components are pure, or if they produce side effects, clean up properly. I would suggest to check three things: • are you on react 17 or 18? if 18, then it may be a reagent bug. if 17, continue reading • if your component is a form-2 component, are you dereferencing the ratom in the fn or outside? if outside, that is problematic • if you are passing the ratom as a prop, you'll need to be careful where you deref the ratom, so that the appropriate function is called when it updates
@hifumi123 I'm on React 18, yes. The component is the top-most one. I'm not sure whether it's reagent, disabling strict mode did it.