Repository navigation
Commit 22326e3
committed
fix(octane-evals): shadow browser globals in server eval to simulate real Node SSR
The serverModule function evaluates server-compiled code via new Function in
the jsdom test context, where window/document/self are defined. This caused
typeof window === 'undefined' guards in lazy useState initializers to
incorrectly see window as defined, making valid repair patterns (e.g.
listener-without-cleanup with added cleanup) fail the server-renders-1024
assertion even though they work correctly in real Node SSR.
Shadow window, document, and self as undefined in the new Function parameters
so the server evaluation matches real Node.js behavior.1 parent 8601c41 commit 22326e3
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
0 commit comments