[CC] Track APIs that cause incompatible static/app shells (#97040)
Certain APIs resolve in different stages depending on whether they're in a static prerender or a runtime prerender: - static params - navigation() and prefetch() (upcoming) When a page uses one of these, we need separate renders for Static and Instant validation. Previously, static `params` was the only instance of this, and we could detect those for a route statically. However, we have no way of statically knowing if the upcoming `navigation()` or `prefetch()` are going to be called on a given route, so we need to switch to dynamically tracking API usage instead. We do this via a mutable field `workUnitStore.hasIncompatibleShellContent`, which starts out as `false` and may get set to `true` if one of the APIs is used. Conceptually, the field works in tandem with `workUnitStore.needsAppShell`¹ -- `needsAppShell` controls when things resolve, and `hasIncompatibleShellContent` tracks whether the result would've been equivalent if `needsAppShell` was set to the opposite value (i.e. are the static and runtime shells equivalent) This PR moves static `params` to use this new method. We instrument the resulting `params` promise and set `hasIncompatibleShellContent` when it's `then()`ed, which seems close enough to tracking use. No new tests are added, because the existing tests that check if unguarded `generateStaticParams` trigger instant validation errors in `partialPrefetching` exercise this codepath already. --- ¹ `needsSessionShell` was renamed to `needsAppShell`, because "session shell" is not really a term we're using anywhere else right now, it's basically a leftover
Showing
Please
register
or
sign in
to comment