Skip to content

Commit

Permalink
[dynamicIO] warn for disallowed dynamic in dev
Browse files Browse the repository at this point in the history
Previously our rules for allowed dynamic were only enforced in builds. This is not tenable for serious adoption because you can't spend all day working on your site and then find out its broken when you build / deploy.

To address this I've added a simulated prerendering during dev that should enforce the same rules for rendered routes in dev that would apply during a build. There is no way to avoid doing additional work to implement this feature because we need the abort mechanism of SSR to actually find the dynamic holes that should be disallowed. I was able to avoid completly duplicating the RSC render however by capturing the stream chunks available before the first task completes and stashign them away as a simluated halted RSC payload.

I did have to introduce prospective renders to the RSC render and the validating SSR render however to work aroudn issues of lazy module initialization where functions like Math.random and new Date() in module scope would incorrectly trigger dynamic validation when you would not expect them to.
  • Loading branch information
gnoff committed Oct 20, 2024
1 parent dab4d00 commit 8daf4b7
Show file tree
Hide file tree
Showing 7 changed files with 447 additions and 44 deletions.
Loading

0 comments on commit 8daf4b7

Please sign in to comment.