💥 Regression Report
When cloning an instance, if you pass in config containing any interpolation options, some interpolation behaviors may break.
This creates a regression in next-i18next, which clones instances on the server and not on the client. Incorrect translations are generated server-side, leading to hydration errors.
I think it's because when creating an instance, options.interpolation gets populated with defaults (here). But when cloning an instance, effectively this is attached to the clone: new Interpolator({ ...oldConfig, ...newConfig, isClone: true }) (here).oldConfig.interpolation gets replaced by newConfig.interpolation, which does not have those defaults.
This probably could be fixed in next-i18next by not passing config into cloneInstance. However, I think it's very surprising that defaults are sometimes used and sometimes not.
Last working version
Worked up to version: 25.6.3
Stopped working in version: 25.7.0
To Reproduce
https://codesandbox.io/p/sandbox/yfgs43
test1 and test2 produce "My list: foo and bar". test3 produces "My list: foo,bar". If you change the version to 25.6.3, test3 works correctly.
Expected behavior
Explained above.
Your Environment
n/a
💥 Regression Report
When cloning an instance, if you pass in config containing any interpolation options, some interpolation behaviors may break.
This creates a regression in
next-i18next, which clones instances on the server and not on the client. Incorrect translations are generated server-side, leading to hydration errors.I think it's because when creating an instance,
options.interpolationgets populated with defaults (here). But when cloning an instance, effectively this is attached to the clone:new Interpolator({ ...oldConfig, ...newConfig, isClone: true })(here).oldConfig.interpolationgets replaced bynewConfig.interpolation, which does not have those defaults.This probably could be fixed in
next-i18nextby not passingconfigintocloneInstance. However, I think it's very surprising that defaults are sometimes used and sometimes not.Last working version
Worked up to version: 25.6.3
Stopped working in version: 25.7.0
To Reproduce
https://codesandbox.io/p/sandbox/yfgs43
test1andtest2produce "My list: foo and bar".test3produces "My list: foo,bar". If you change the version to 25.6.3,test3works correctly.Expected behavior
Explained above.
Your Environment
n/a