Not loading on server-side (empty translations on 1st load)

gahabeen
0
gahabeen
commented 2 months ago

Version

v5.3.0

Reproduction link

https://noreproductionlink.com

Steps to reproduce

I'm using lazy loading just so I can extract for each language the right translations from a unique js object. (To understand, I've got everything in one place and I'm splitting it for each language).

I've got translations.js file which contains such kind of entries:
{ "hello": { "en": "hello", "fr": "bonjour" }, "hi": { "en": "hi", "fr": "salut" }}

which simplifies through a function (so it's dynamic / lazy) to the following files:
en.js { "hello": "hello", "hi": "hi" }
fr.js { "hello": "bonjour", "hi": "salut" }

What is expected ?

Translation shows up on first load

What is actually happening?

On firt load, I see [Object object] instead of the translations because somehow it doesn't resolve quick enough to the right language?

Additional comments?

I don't feel like the lazy/resolve part is done on the server (ssr), am I right? Could it be? That would solve my issue I think.

bug
0
rchl
578
rchl
commented 2 months ago

I would ask you to either create a small repro (using https://codesandbox.io for example), or at least show the code from the file that is being lazy loaded.

0
Informations
Bug Report โ€ข Open
#c316 - Created 2 months ago