Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR extends navigation routing across multiple components by passing Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 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
🧹 Nitpick comments (2)
src/lib/components/MobileInfo.svelte (1)
2-2: Add explicit types for the props.Since this file uses
<script lang="ts">, the newly addedclassId(and existingmodule) prop is currently typed asany. For consistency withModuleInfo.svelte(which typesclassId: Id<'class'>), and to catch mis-wiring from callers at build time, consider:♻️ Proposed typing
- let { module, classId } = $props(); import { ArrowLeft } from 'lucide-svelte'; import { resolve } from '$app/paths'; + import type { Doc, Id } from '../../convex/_generated/dataModel'; + + let { + module, + classId + }: { + module: { data: Doc<'module'> }; + classId: Id<'class'>; + } = $props();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/components/MobileInfo.svelte` at line 2, The props in MobileInfo.svelte are currently implicitly any; add explicit TypeScript types to the destructured props so they match ModuleInfo.svelte (e.g., type the module prop appropriately and set classId: Id<'class'>) by updating the prop declaration that reads let { module, classId } = $props() to include the correct types for module and classId so callers are type-checked at build time.src/lib/components/QuizSideBar.svelte (1)
15-17: Dedupe themoduleSelectionHrefderivation.The exact same derivation now exists in three components (
ModuleInfo.svelte,QuizSideBar.svelte,MobileInfo.svelte). Consider extracting a small helper such asbuildClassesHref(classId)in$lib/utilsso future route/query-param changes only need to be made in one place.♻️ Example helper
// $lib/utils/navigation.ts import { resolve } from '$app/paths'; export function buildClassesHref(classId: string): string { return `${resolve('/classes')}?classId=${encodeURIComponent(classId)}`; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/components/QuizSideBar.svelte` around lines 15 - 17, moduleSelectionHref is duplicated across ModuleInfo.svelte, QuizSideBar.svelte, and MobileInfo.svelte; extract a helper (e.g., buildClassesHref in $lib/utils/navigation.ts) that wraps resolve('/classes') and encodeURIComponent for classId, then replace the moduleSelectionHref derivation in each component with a call to buildClassesHref(classId) (importing the helper) so route/query logic lives in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/components/ModuleInfo.svelte`:
- Around line 38-40: The URL query string is currently appended outside
resolve(), which violates svelte/no-navigation-without-resolve; update the code
so resolve() receives the full path including the query (e.g., call
resolve(`/classes?classId=${encodeURIComponent(String(classId))}`)) and do the
same change for moduleSelectionHref in ModuleInfo.svelte and the analogous
variables in QuizSideBar.svelte and MobileInfo.svelte; to avoid duplication,
extract the encodeURIComponent(String(classId)) logic into a shared helper
(e.g., a util like formatClassIdQuery or buildClassHref) and use that helper
when constructing the resolve() argument.
---
Nitpick comments:
In `@src/lib/components/MobileInfo.svelte`:
- Line 2: The props in MobileInfo.svelte are currently implicitly any; add
explicit TypeScript types to the destructured props so they match
ModuleInfo.svelte (e.g., type the module prop appropriately and set classId:
Id<'class'>) by updating the prop declaration that reads let { module, classId }
= $props() to include the correct types for module and classId so callers are
type-checked at build time.
In `@src/lib/components/QuizSideBar.svelte`:
- Around line 15-17: moduleSelectionHref is duplicated across ModuleInfo.svelte,
QuizSideBar.svelte, and MobileInfo.svelte; extract a helper (e.g.,
buildClassesHref in $lib/utils/navigation.ts) that wraps resolve('/classes') and
encodeURIComponent for classId, then replace the moduleSelectionHref derivation
in each component with a call to buildClassesHref(classId) (importing the
helper) so route/query logic lives in one place.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e5b74e29-da8b-446b-9e0c-f6dd22cfdc12
📒 Files selected for processing (5)
src/convex/gradeCalculatorCatalog.tssrc/lib/components/MainQuiz.sveltesrc/lib/components/MobileInfo.sveltesrc/lib/components/ModuleInfo.sveltesrc/lib/components/QuizSideBar.svelte
| const moduleSelectionHref = $derived( | ||
| `${resolve('/classes')}?classId=${encodeURIComponent(String(classId))}` | ||
| ); |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
SvelteKit 2 resolve function from $app/paths query parameters support
💡 Result:
Yes, in SvelteKit 2 (specifically version 2.54.0 and later), the resolve function from #14756) added optional { searchParams, hash } object params, but the primary query string support comes from PR #15458 merged March 3, 2026, released in 2.54.0 (March 11, 2026). As of 2026-04-23, latest is 2.57.1, so fully supported in current versions. Official docs confirm via type signatures: function resolve<T extends RouteIdWithSearchOrHash | PathnameWithSearchOrHash>(...args: ResolveArgs): ResolvedPathname;
Citations:
- 1: https://svelte.dev/docs/kit/$app-paths
- 2: https://github.com/sveltejs/kit/pull/15458/changes
- 3: https://svelte-changelog.dev/pull/sveltejs/kit/15458
- 4: https://svelte.dev/docs/kit/%24app-paths
- 5: feat: allow resolve() to accept pathnames with query strings and hash fragments sveltejs/kit#15458
- 6: https://github.com/sveltejs/kit/releases/tag/%40sveltejs/kit%402.56.0
- 7: https://www.npmjs.com/package/@sveltejs/kit?activeTab=versions
- 8: sveltejs/kit@54dadc1
🏁 Script executed:
cat package.json | grep -A 2 '@sveltejs/kit'Repository: jdang00/learnterms
Length of output: 175
🏁 Script executed:
fd -e svelte -type f | grep -E '(ModuleInfo|QuizSideBar|MobileInfo)' | head -20Repository: jdang00/learnterms
Length of output: 232
🏁 Script executed:
rg "const.*Href.*\$derived" --type svelte -A 2Repository: jdang00/learnterms
Length of output: 92
🏁 Script executed:
fd -name "ModuleInfo.svelte" -o -name "QuizSideBar.svelte" -o -name "MobileInfo.svelte"Repository: jdang00/learnterms
Length of output: 292
🏁 Script executed:
rg "const.*Href.*\$derived" -A 2 --glob "*.svelte"Repository: jdang00/learnterms
Length of output: 44
🏁 Script executed:
cat -n src/lib/components/ModuleInfo.svelte | sed -n '35,45p'Repository: jdang00/learnterms
Length of output: 440
🏁 Script executed:
fd "\.svelte$" | head -30Repository: jdang00/learnterms
Length of output: 1245
🏁 Script executed:
rg "QuizSideBar|MobileInfo" --glob "*.svelte" -lRepository: jdang00/learnterms
Length of output: 96
🏁 Script executed:
rg "Href.*\$derived" --glob "*.svelte" -B 1 -A 1Repository: jdang00/learnterms
Length of output: 44
🏁 Script executed:
fd "\.svelte$" | xargs grep -l "classId"Repository: jdang00/learnterms
Length of output: 1498
🏁 Script executed:
fd "\.svelte$" | xargs grep -l "moduleSelectionHref\|classSelectionHref"Repository: jdang00/learnterms
Length of output: 573
🏁 Script executed:
cat -n src/lib/components/MainQuiz.svelte | sed -n '1,50p'Repository: jdang00/learnterms
Length of output: 2190
🏁 Script executed:
rg "resolve.*classId|classId.*resolve" src/lib/components/QuizSideBar.svelte -B 2 -A 2Repository: jdang00/learnterms
Length of output: 264
🏁 Script executed:
rg "resolve.*classId|classId.*resolve" src/lib/components/MobileInfo.svelte -B 2 -A 2Repository: jdang00/learnterms
Length of output: 189
🏁 Script executed:
cat -n src/lib/components/QuizSideBar.svelte | grep -E "resolve|Href" -B 2 -A 2Repository: jdang00/learnterms
Length of output: 1254
🏁 Script executed:
find . -name ".eslintrc*" -o -name "eslint.config.*" | head -5Repository: jdang00/learnterms
Length of output: 305
🏁 Script executed:
cat -n src/lib/components/ModuleInfo.svelte | head -1Repository: jdang00/learnterms
Length of output: 87
🏁 Script executed:
rg "no-navigation-without-resolve" --type-list | head -5Repository: jdang00/learnterms
Length of output: 451
🏁 Script executed:
find node_modules/@sveltejs/kit -name "*.d.ts" | xargs grep -l "resolve" | head -3Repository: jdang00/learnterms
Length of output: 230
🏁 Script executed:
cat eslint.config.jsRepository: jdang00/learnterms
Length of output: 901
🏁 Script executed:
cat node_modules/@sveltejs/kit/src/runtime/app/paths/public.d.tsRepository: jdang00/learnterms
Length of output: 1307
🏁 Script executed:
rg "no-navigation-without-resolve" eslint.config.jsRepository: jdang00/learnterms
Length of output: 44
🏁 Script executed:
cat node_modules/@sveltejs/kit/src/types/index.d.ts | grep -A 10 "RouteIdWithSearchOrHash\|PathnameWithSearchOrHash" | head -30Repository: jdang00/learnterms
Length of output: 141
🏁 Script executed:
cat node_modules/@sveltejs/kit/src/runtime/app/paths/types.d.tsRepository: jdang00/learnterms
Length of output: 721
🏁 Script executed:
rg "svelte/no-navigation-without-resolve" node_modules/eslint-plugin-svelte -A 5 | head -50Repository: jdang00/learnterms
Length of output: 3147
🏁 Script executed:
find . -path ./node_modules -prune -o -name "*utils*" -type f | grep -E "\.(ts|js|svelte)$" | head -20Repository: jdang00/learnterms
Length of output: 44
🏁 Script executed:
rg "resolve.*?search|searchParams" node_modules/@sveltejs/kit --type ts --type js -A 2 | head -50Repository: jdang00/learnterms
Length of output: 3913
🏁 Script executed:
cat node_modules/@sveltejs/kit/src/runtime/app/paths/client.js 2>/dev/null || cat node_modules/@sveltejs/kit/dist/client.js | head -50Repository: jdang00/learnterms
Length of output: 3011
🏁 Script executed:
rg "no-navigation-without-resolve" node_modules/eslint-plugin-svelte/docs -A 20 | head -60Repository: jdang00/learnterms
Length of output: 140
🏁 Script executed:
find node_modules/eslint-plugin-svelte -name "*.md" -o -name "*.js" | xargs grep -l "no-navigation-without-resolve" | head -3Repository: jdang00/learnterms
Length of output: 248
🏁 Script executed:
cat node_modules/eslint-plugin-svelte/docs/rules/no-navigation-without-resolve.md 2>/dev/null | head -100Repository: jdang00/learnterms
Length of output: 44
🏁 Script executed:
cat node_modules/eslint-plugin-svelte/lib/rules/no-navigation-without-resolve.js | head -150Repository: jdang00/learnterms
Length of output: 6199
🏁 Script executed:
rg "resolve.*\?" src/lib/components -A 1 -B 1Repository: jdang00/learnterms
Length of output: 989
🏁 Script executed:
cat node_modules/@sveltejs/kit/src/runtime/app/paths/client.js | grep -A 5 "resolve_route"Repository: jdang00/learnterms
Length of output: 714
🏁 Script executed:
rg "resolve.*\?" src/lib/components/MobileMenu.svelte -B 2 -A 2Repository: jdang00/learnterms
Length of output: 223
🏁 Script executed:
python3 << 'EOF'
# Check SvelteKit 2.53.4 resolve() signature in package.json and types
import json
import os
pkg_path = 'node_modules/@sveltejs/kit/package.json'
if os.path.exists(pkg_path):
with open(pkg_path) as f:
pkg = json.load(f)
print(f"Version: {pkg.get('version')}")
print(f"Main: {pkg.get('main')}")
EOFRepository: jdang00/learnterms
Length of output: 88
🏁 Script executed:
# Check if the resolve() function handles query strings in pathname
rg "resolve_route\(" node_modules/@sveltejs/kit/src/utils -A 10 | head -40Repository: jdang00/learnterms
Length of output: 900
🏁 Script executed:
cat node_modules/@sveltejs/kit/src/utils/routing.js | head -30Repository: jdang00/learnterms
Length of output: 901
🏁 Script executed:
rg "PathnameWithSearchOrHash|RouteIdWithSearchOrHash" node_modules/@sveltejs/kit/src/types -A 2 | head -50Repository: jdang00/learnterms
Length of output: 549
🏁 Script executed:
rg "Pathname|PathnameWithSearchOrHash" node_modules/@sveltejs/kit/src/types/ambient.d.ts -B 1 -A 1Repository: jdang00/learnterms
Length of output: 621
🏁 Script executed:
# Verify resolve() actual behavior with query strings
cat node_modules/@sveltejs/kit/src/utils/routing.js | tail -20Repository: jdang00/learnterms
Length of output: 602
Move the query string inside the resolve() call to satisfy the lint rule.
The svelte/no-navigation-without-resolve rule expects the entire URL (including query params) to be constructed within resolve(). SvelteKit's resolve() API already supports query strings and hash fragments directly in the pathname:
- const moduleSelectionHref = $derived(
- `${resolve('/classes')}?classId=${encodeURIComponent(String(classId))}`
- );
+ const moduleSelectionHref = $derived(
+ resolve(`/classes?classId=${encodeURIComponent(String(classId))}`)
+ );This pattern is duplicated across ModuleInfo.svelte, QuizSideBar.svelte, and MobileInfo.svelte. Consider extracting the encodeURIComponent logic into a shared utility to reduce duplication.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const moduleSelectionHref = $derived( | |
| `${resolve('/classes')}?classId=${encodeURIComponent(String(classId))}` | |
| ); | |
| const moduleSelectionHref = $derived( | |
| resolve(`/classes?classId=${encodeURIComponent(String(classId))}`) | |
| ); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/components/ModuleInfo.svelte` around lines 38 - 40, The URL query
string is currently appended outside resolve(), which violates
svelte/no-navigation-without-resolve; update the code so resolve() receives the
full path including the query (e.g., call
resolve(`/classes?classId=${encodeURIComponent(String(classId))}`)) and do the
same change for moduleSelectionHref in ModuleInfo.svelte and the analogous
variables in QuizSideBar.svelte and MobileInfo.svelte; to avoid duplication,
extract the encodeURIComponent(String(classId)) logic into a shared helper
(e.g., a util like formatClassIdQuery or buildClassHref) and use that helper
when constructing the resolve() argument.
Summary by CodeRabbit
New Features
Improvements