Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic APIs #60645

Merged
merged 4 commits into from
Jan 24, 2024
Merged

Dynamic APIs #60645

merged 4 commits into from
Jan 24, 2024

Commits on Jan 23, 2024

  1. Implements a concept and set of APIs related to "Dynamic Rendering". …

    …Previously this was talked about externally in Docs but implemented as a staticGenerationBailout. There are however different semantics we want to have for dynamic using htings like `unstable_noStore` vs `headers()` for instance and having APIs oriented around these semantics will make future planned changes easier to implement correctly.
    
    The two main semantics are "the currently executing scope should be dynamic" and "some dynamic data source is being read"
    
    The former will eventually be a noop if we make dynamic the default. In accordance with this the dynamic intent is ignored inside a cache scope from `unstable_cache`. This is a very weak form of dynamic scoping and makes sense because it does not entail a request specific data read.
    
    The latter semantic is a stronger form. when doing any kind of static generation we disallow reading dynamic data sources such as headers, cookies, and searchParams. If these are read during a static render the render will bailout or postpone (depending on whether we are using PPR or not)
    
    force-static should still forcibly prevent dynamic data reads. This is now implementation outside of the triggering of a dynamic data read.
    
    This PR does not actually change yet how we define whether the result of a render was fully, partially, or not static. This will come in a follow up change where we can more faithfully track whether dynamic APIs were used separately from whether the render postpones.
    gnoff committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    e66ae43 View commit details
    Browse the repository at this point in the history
  2. Adds tests to cover some of the new erroring semantics around dynamic…

    …ally tracked data reads
    gnoff committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    b8f40bc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d59e4b8 View commit details
    Browse the repository at this point in the history
  4. removes static-generation-bailout entirely by refactoring last usages…

    … to other dynamic apis and bailout techniques
    gnoff committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    2324e67 View commit details
    Browse the repository at this point in the history