Fork me on GitHub
#fulcro
<
2023-11-03
>
Eric Dvorsak12:11:34

I found what I believe might be a bug with fulcro i18n: in dev changing the local works as expected, but in release builds it only change once then nothing happen on subsequent changes

Eric Dvorsak13:11:14

Interestingly it does change the language of the footer where the language selection is but not the rest of the page

Eric Dvorsak14:11:53

force-root-render! gets called every time

Eric Dvorsak16:11:00

I wonder if it has to do with react 18+

Eric Dvorsak17:11:13

it really looks like react is optimizing the re-rendering away 😄

Eric Dvorsak18:11:00

Seems like you can't trust the rerender with react 18+ even with force-root? true it doesn't re-render everything which is a bummer when you are trying to change the locale through shared props

Eric Dvorsak19:11:06

So my current fix is to dissoc the current locale translations, because I have when (some? (::i18n/translations current-locale)) in my root so the whole page is unmounted when the translation is changed, which I guess was the idea of force-render but new react is too hardcore

Eric Dvorsak18:11:00

Seems like you can't trust the rerender with react 18+ even with force-root? true it doesn't re-render everything which is a bummer when you are trying to change the locale through shared props

tony.kay20:11:20

I dropped the check for goog DEBUG and released. It will work now

Eric Dvorsak20:11:57

Since that fixes my issue with i18n above I'd conclude that was a bug in fulcro https://github.com/fulcrologic/fulcro/pull/548

tony.kay18:11:20

Oh, I see. Yeah, the force root was really intended for dev time builds, but I forgot about i18n needing it to change locales

tony.kay18:11:33

OK, I’ll accept that PR as well, thanks

Eric Dvorsak20:11:49

Thanks for fixing the fix, I wrongly assumed that the idea was to always re-render when in debug mode but I realize it was silly