-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing api/auth, api/guides pages (#9153)
The `api/auth` route added for the changelog conflicts with the `api/auth` docs page that would normally be handled by the catchall `[[...path]]` route. Move it under the `changelog` path to fix the route conflict. Even so, the pages continued to 404. Commit 680c7c4 added memoized the fetch for OpenAPI JSON in the `resolveOpenAPI` function, but that particular implementation caused some problems with the build output. Some of the pages in the API section went missing. The previous implementation was susceptible to a bit of a race condition, since the cached value wasn't set until after several async calls. When Next tries to aggressively build pages, multiple calls could have gotten through to do live calls, and then all of them would have tried to set the cache variable. I don't know the exact pathway to the issue but I suspect this had something to do with the missing pages (some sort of data corruption?). Sorry, I know this is handwavy. Anyway, replacing that implementation with a more robust one - one that caches a promise on the first call, and reuses that promise on all future calls - will definitely only fetch once per process. When the fetch completes, everyone waiting on the promise will awaken, and then future callers of the method will get a resolved promise for immediate results. And, most importantly, this method of caching doesn't cause the `api/auth` and `api/guides` pages to go missing.
- Loading branch information
Showing
6 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters