Repository navigation
fix(dev): fall back to the project's loading template - #1419
Conversation
commit: |
π WalkthroughWalkthroughThe change adds cached loading-template resolution from the projectβs installed Estimated code review effort: 3 (Moderate) | ~20 minutes π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 warning)
β Passed checks (4 passed)
β¨ Finishing Touches π‘ 1π Generate docstrings π‘
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/nuxt-cli/src/dev/loading-template.ts`:
- Around line 17-19: Update resolveDefaultLoadingTemplate to replace the single
cached promise with a cache keyed by cwd (or the canonical schema path),
ensuring each project resolves and reuses only its own loading template. Add a
regression test covering two different project directories and verify each
receives the correct template.
πͺ Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f2b4620a-343b-4e21-b101-91567f05a638
π Files selected for processing (3)
packages/nuxt-cli/src/dev/loading-template.tspackages/nuxt-cli/src/dev/utils.tspackages/nuxt-cli/test/e2e/dev-loading.spec.ts
| export function resolveDefaultLoadingTemplate(cwd: string): Promise<LoadingTemplate | undefined> { | ||
| return cached ??= importDefaultLoadingTemplate(cwd) | ||
| } |
There was a problem hiding this comment.
π― Functional Correctness | π Major | β‘ Quick win
Key the loading-template cache by project.
Line 18 stores one promise for the entire process. The first call fixes the template for all later cwd values. A later dev server can then use another project's @nuxt/schema template and Nuxt version.
Store cached promises in a Map keyed by cwd or by the canonical resolved schema path. Add a regression test that resolves templates for two different project directories.
π€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/nuxt-cli/src/dev/loading-template.ts` around lines 17 - 19, Update
resolveDefaultLoadingTemplate to replace the single cached promise with a cache
keyed by cwd (or the canonical schema path), ensuring each project resolves and
reuses only its own loading template. Add a regression test covering two
different project directories and verify each receives the correct template.
π Linked issue
π Description
we drop support for older nuxt versions (so we no longer need to try to resolve the loading template from
@nuxt/ui-templates- it's been available onnuxt.optionsfor a very long time)but we still add a fallback - resolving from
@nuxt/schemainstead of ui-templates