Repository navigation
fix(module): register server templates in a fixed order - #408
Merged
HugoRCD merged 1 commit intoNov 2, 2026
Merged
Conversation
Contributor
|
@onmax is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
With many layers, the key order of
nuxt.options.nitro.virtualchanges between identical builds. The output is the same, but a hash of the Nitro config (for example, a build cache key) changes on each build.loadAllDefinitionsruns five loaders withPromise.all. Each loader callsaddServerTemplatewhen its scan finishes, so the keys are added in the order the scans finish.Repro
The app extends 20 layers. Each layer has one tool, one prompt and one resource in
server/mcp/. This script loads the app 10 times and shows the keys:Before the fix, there are 7 different orders in 10 runs (prefix removed):
After the fix, all 10 runs give the same order:
Fix
The scans still run in parallel. Each loader now returns its template and does not register it. After
Promise.allis complete,loadAllDefinitionsregisters the five templates in this order: tools, resources, prompts, handlers, default handler. The template contents do not change.test/loaders-order.test.tsmakes the scan of one definition type slow, then checks the order. Before the fix, all 3 cases fail.🤖 Generated with Claude Code