Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Before hydration and using signals my code worked. I refactored it to use signals and incremental hydration and it broke. The error message was not really meaningful: Cannot add property i18nNodes, object is not extensible
I use apollo-angular which freezes every object in its state and results. The state cannot be modified.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Cannot add property i18nNodes, object is not extensible
The line where the error has happened is https://github.com/angular/angular/blob/4491704fbaec02db8eec5845ffbb200dbf2a0bf6/packages/core/src/hydration/i18n.ts#L660
Please provide the environment you discovered this bug in (run ng version)
NX 20.3.0
Angular 19.0.5
Angular SSR 19.0.6
Anything else?
Workaround:
Unfreeze the object using some hacky js code: const unfrozenObj = JSON.parse(JSON.stringify(obj));
Possible solutions:
Check before trying to set the values if the object is frozen using: Object.isExtensible(object).
- Throw an error that the state is not extensible and provide some information on the current component which has the error.
- Show a warning during development and provide some information on the current component which has the error. In production mode ignore it.
- Ignore setting the values without any warning.
I am very happy to code and make a PR on any of the solutions if the Angular team has decided.
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Before hydration and using signals my code worked. I refactored it to use signals and incremental hydration and it broke. The error message was not really meaningful:
Cannot add property i18nNodes, object is not extensibleI use apollo-angular which freezes every object in its state and results. The state cannot be modified.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
Workaround:
Unfreeze the object using some hacky js code:
const unfrozenObj = JSON.parse(JSON.stringify(obj));Possible solutions:
Check before trying to set the values if the object is frozen using:
Object.isExtensible(object).I am very happy to code and make a PR on any of the solutions if the Angular team has decided.