[core] Fix next
using stale pages
#24635
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We're currently computing all the available pages in
/api
at runtime. Since we rely on the filesystem, we're usingbabel-preval
to compute the api pages at transpile time. However, transpiled files are cached and we cannot invalidate that the cache for a particular file. This leads to netlify deploys failing on a cache hit when pages changed (e.g. in #24626: https://app.netlify.com/sites/material-ui/deploys/60103453834bf5000813eeee).Invalidating just
babel-preval
is currently not possible (kentcdodds/babel-plugin-preval#19).We're now hardcoding /api pages just like any other page. This reduces complexity of what is considered a page. Since we already require committing
yarn docs:api
changes, we can leverage that script to generate the necessary page entries.TODO:
babel-plugin-preval
pagesAPI
indocs:api
Aside:
src/pages
is currently the wrong abstraction. It doesn't contain nextjs pages but items for the nav. Not every nav item is a nextjs page e.g./components/data-grid
is hosted somewhere else and handled via netlify redirects. Orhttps://medium.com/material-ui
which is just an external link. Might be worth entangling but I'm waiting for another bug to arise from this premature abstraction.