Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dynamicIO] warn for disallowed dynamic in dev
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