You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Improve hydration mismatch errors for third-party scripts
Improves error messages shown during hydration mismatches to better
surface cases where third-party scripts or browser extensions have
modified the DOM outside of Angular's control.
Fixedangular#59224
expect(message).toContain('During hydration Angular expected <b> but found <span>');
6198
6198
expect(message).toContain('<b>…</b> <-- AT THIS LOCATION');
6199
6199
expect(message).toContain('<span>…</span> <-- AT THIS LOCATION');
6200
+
expect(message).toContain(
6201
+
'check if there are any third-party scripts that manipulate the DOM. More info: https://angular.dev/guide/hydration#third-party-scripts-with-dom-manipulation',
6202
+
);
6200
6203
verifyNodeHasMismatchInfo(doc);
6201
6204
});
6202
6205
});
6203
6206
6207
+
it('should suggest afterNextRender if a third-party script injected a node',async()=>{
expect(message).toContain('During hydration Angular expected <div> but found <ins>');
6232
+
expect(message).toContain(
6233
+
'check if there are any third-party scripts that manipulate the DOM. More info: https://angular.dev/guide/hydration#third-party-scripts-with-dom-manipulation',
6234
+
);
6235
+
expect(message).toContain(
6236
+
'Note: It looks like this node was injected by a third-party script or browser extension',
6237
+
);
6238
+
expect(message).toContain(
6239
+
'Angular hydration does not support nodes injected outside of the Angular-managed DOM',
6240
+
);
6241
+
expect(message).toContain('Consider using `afterNextRender` to delay script execution');
0 commit comments