Skip to content

Commit

Permalink
fix(@angular/build): perform full reload for templates with `$localiz…
Browse files Browse the repository at this point in the history
…e` usage

Component template updates that contain `$localize` usage currently may
result in incorrect updates at runtime. To avoid this problem, any template
update module that contains `$localize` will now perform a full rebuild.
Support for component updates of these templates will be added in a future
release.

(cherry picked from commit bfaa4d2)
  • Loading branch information
clydin authored and alan-agius4 committed Jan 20, 2025
1 parent 7d8c341 commit c4de347
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ export class AotCompilation extends AngularCompilation {
`${host.getCanonicalFileName(relativePath)}@${node.name?.text}`,
);
const updateText = angularCompiler.emitHmrUpdateModule(node);
if (updateText === null) {
// If compiler cannot generate an update for the component, prevent template updates.
// Also prevent template updates if $localize is directly present which also currently
// prevents a template update at runtime.
// TODO: Support localized template update modules and remove this check.
if (updateText === null || updateText.includes('$localize')) {
// Build is needed if a template cannot be updated
templateUpdates = undefined;
break;
Expand Down

0 comments on commit c4de347

Please sign in to comment.