A tool to help Granblue Fantasy players create and share teams and strategies.
Find a file
devin-ai-integration[bot] f9bb43f214
feat: migrate components to TanStack Query v6 (Phase 2) (#442)
# feat: migrate components to TanStack Query v6 (Phase 2)

## Summary

This PR migrates 4 components from the custom
`createInfiniteScrollResource` pattern to TanStack Query v6's
`createInfiniteQuery`:

- **JobSkillSelectionSidebar** - Job skill search with infinite scroll
and category filtering
- **SearchContent** - Search modal for weapons/characters/summons with
element/rarity/proficiency filters
- **User Profile Page** (`[username]/+page.svelte`) - User's teams and
favorites with tab switching
- **Teams Explore Page** (`teams/explore/+page.svelte`) - Public teams
listing

All components now use:
- TanStack Query v6 infinite query pattern with thunk for reactivity
- `IsInViewport` from runed for intersection-based infinite scroll
- Debounced search (debounce the value, not the query)
- Proper loading, error, and empty states
- SSR integration with `initialData` pattern

## Updates since last revision

- **Fixed duplicate key error in SearchContent.svelte** - The API can
return the same item across multiple pages during infinite scroll (e.g.,
due to items being added/removed between page fetches). This caused
Svelte's keyed each block to throw `each_key_duplicate` errors. Fixed by
deduplicating results by `id` using a Map before rendering.

## Review & Testing Checklist for Human

This is a medium-risk change affecting core user-facing pages. Please
verify:

- [ ] **Infinite scroll works on all 4 pages** - Scroll to bottom and
verify more items load automatically
- [ ] **No duplicate items appear in search results** - After the fix,
scrolling through many pages of search results should not show
duplicates
- [ ] **SSR hydration** - Verify no flash of loading state on initial
page load (data should be pre-rendered)
- [ ] **User profile tab switching** - Test switching between "Teams"
and "Favorites" tabs; verify correct data loads
- [ ] **Search debouncing** - Type quickly in JobSkillSelectionSidebar
and SearchContent; verify queries aren't fired on every keystroke
- [ ] **Error states** - Simulate network failure and verify retry
button works

**Recommended Test Plan:**
1. Navigate to `/teams/explore` - verify teams load and infinite scroll
works
2. Navigate to a user profile page - verify teams load, switch to
favorites tab, verify favorites load
3. Open the search sidebar - search for weapons/characters/summons,
scroll through many pages, verify no duplicate key errors and no
duplicate items
4. Open job skill selection - search and filter skills, verify results

### Notes

- The Party component mutations migration (Follow-Up Prompt 5) was
deferred to a follow-up PR due to complexity
- Deprecated resource classes remain in codebase for now; removal
planned for separate PR
- Pre-existing paraglide module errors in build are unrelated to this PR
- Type assertions (`as unknown as`, `as any`) are used to handle
different query result structures between favorites and parties queries

**Link to Devin run:**
https://app.devin.ai/sessions/5aa7ea29edf34f569f95f13acee9e0d9
**Requested by:** Justin Edmund (justin@jedmund.com) / @jedmund

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Justin Edmund <justin@jedmund.com>
2025-11-29 01:11:24 -08:00
.storybook Init Svelte migration repo 2025-09-08 13:43:09 -07:00
.vscode Add project configuration files 2025-09-15 04:12:26 -07:00
docs add perpetuity ring toggle and fix grid api response handling 2025-09-25 01:08:25 -07:00
messages add context menu ui components and i18n 2025-09-30 03:42:14 -07:00
project.inlang Add project configuration files 2025-09-15 04:12:26 -07:00
src feat: migrate components to TanStack Query v6 (Phase 2) (#442) 2025-11-29 01:11:24 -08:00
static Init Svelte migration repo 2025-09-08 13:43:09 -07:00
.gitignore Low-risk cleanup: unused imports, gitignore, auth types, test routes (#439) 2025-11-28 11:21:24 -08:00
.mcp.json Add project configuration files 2025-09-15 04:12:26 -07:00
.npmrc Init Svelte migration repo 2025-09-08 13:43:09 -07:00
.prettierignore Init Svelte migration repo 2025-09-08 13:43:09 -07:00
.prettierrc Update config files 2025-09-09 00:27:09 -07:00
CLAUDE.md remove barrel files and update imports 2025-09-29 23:37:37 -07:00
CLEANUP_PLAN.md fix: type errors and cleanup for svelte-main branch 2025-11-28 20:08:10 +00:00
eslint.config.js Update config files 2025-09-09 00:27:09 -07:00
NEXT_SESSION_PROMPT.md docs: update NEXT_SESSION_PROMPT.md with current progress (161 errors remaining) 2025-11-28 21:25:11 +00:00
package.json add tanstack query with infinite scroll support 2025-11-28 11:00:57 -08:00
pnpm-lock.yaml add tanstack query with infinite scroll support 2025-11-28 11:00:57 -08:00
README.md Init Svelte migration repo 2025-09-08 13:43:09 -07:00
svelte.config.js fix: type errors in svelte-main branch (219 -> 191 errors) 2025-11-28 21:06:05 +00:00
TANSTACK_QUERY_MIGRATION_CONTINUATION.md feat: migrate components to TanStack Query v6 (Phase 2) (#442) 2025-11-29 01:11:24 -08:00
tsconfig.json refactor: remove exactOptionalPropertyTypes and fix import casing 2025-11-28 19:19:32 -08:00
TYPESCRIPT_IMPROVEMENTS.md refactor: consolidate Awakening type definition 2025-11-28 21:48:21 -08:00
vite.config.ts fix scss imports with modern compiler api 2025-09-16 01:35:05 -07:00
vitest-setup-client.ts Init Svelte migration repo 2025-09-08 13:43:09 -07:00
vitest.config.adapter.ts feat: implement base adapter with retry logic and caching 2025-09-19 23:03:36 -07:00

sv

Everything you need to build a Svelte project, powered by sv.

Creating a project

If you're seeing this, you've probably already done this step. Congrats!

# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app

Developing

Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.