brisa-build / brisa

The Web Platform Framework.
https://brisa.build
MIT License
449 stars 12 forks source link

Navigate on server action does not read i18n info #622

Closed AlbertSabate closed 2 weeks ago

AlbertSabate commented 2 weeks ago

Describe the bug When using a navigate on a server actions seems to navigate without considering i18n. When having i18n enabled.

Example:

navigate('/admin') navigates to /admin instead of /en/admin

aralroca commented 2 weeks ago

Can you check the req.finalURL? We check the i18n here:

https://github.com/brisa-build/brisa/blob/1acd7798d1b61752f464dab89bbffb389be32a23/packages/brisa/src/utils/get-locale-from-request/index.ts#L6-L7

AlbertSabate commented 2 weeks ago
local Screenshot 2024-11-10 at 4 55 10 PM

The value after the request is request.finalURL

aralroca commented 2 weeks ago

On the server actions build, is importing all the code of the navigate import, including the "constants", that are different from after the standalone build (server.js file). That's wrong. The incorrect constants does not have the I18N_CONFIG because does not found the i18n.js file there.

Screenshot 2024-11-10 at 23 15 21
AlbertSabate commented 2 weeks ago

v0.1.5-canary.4 fixes this issue.