From 389f73d164bff85c3d1c65ebaa16762fb443578a Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Sat, 26 Jul 2025 21:50:54 +0100 Subject: [PATCH] chore(*): Clean up migration artifacts and optimize data repository queries --- src/lib/components/PokemonSprite.svelte | 4 - .../pokedex/PokedexEntryCatchRecord.svelte | 36 +- .../components/pokedex/PokedexViewList.svelte | 1 + .../repositories/CombinedDataRepository.ts | 83 +- src/routes/mydex/+page.svelte | 7 +- src/routes/signin/+page.svelte | 24 +- supabase/config.toml | 2 +- .../20250126000002_create_pokemon_schema.sql | 13 +- ...126000002_create_pokemon_schema.sql.backup | 130 - ...0126000002_create_pokemon_schema_fixed.sql | 133 - .../20250126000004_seed_full_pokemon_data.sql | 7 - tsv-parser/index.js | 43 - tsv-parser/package-lock.json | 47 - tsv-parser/package.json | 16 - tsv-parser/pokedex.json | 35491 ---------------- tsv-parser/seed-data.tsv | 1391 - 16 files changed, 95 insertions(+), 37333 deletions(-) delete mode 100644 supabase/migrations/20250126000002_create_pokemon_schema.sql.backup delete mode 100644 supabase/migrations/20250126000002_create_pokemon_schema_fixed.sql delete mode 100644 tsv-parser/index.js delete mode 100644 tsv-parser/package-lock.json delete mode 100644 tsv-parser/package.json delete mode 100644 tsv-parser/pokedex.json delete mode 100644 tsv-parser/seed-data.tsv diff --git a/src/lib/components/PokemonSprite.svelte b/src/lib/components/PokemonSprite.svelte index aa29c91..4b0602b 100644 --- a/src/lib/components/PokemonSprite.svelte +++ b/src/lib/components/PokemonSprite.svelte @@ -59,10 +59,6 @@ break; } - // if (strippedPokedexNumber == '869') { - // console.log(sanitisedPokemonName, sanitisedForm); - // } - // If the form is contained in the identifier, use that if ( pokeApiPokemon.find( diff --git a/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte b/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte index 39f28b3..6020e75 100644 --- a/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte +++ b/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte @@ -10,22 +10,24 @@ export let showForms: boolean; export let showShiny: boolean; - // Create a working copy for editing - $: workingCatchRecord = catchRecord || { - _id: `temp-${Date.now()}-${pokedexEntry._id}`, // Generate temporary ID - userId: '', // TODO: Get from session context - pokedexEntryId: pokedexEntry._id, - haveToEvolve: false, - caught: false, - inHome: false, - hasGigantamaxed: false, - personalNotes: '' - }; + // Create a default catch record if none exists + $: if (!catchRecord) { + catchRecord = { + _id: '', // Empty string, not temp ID - will be created by server + userId: '', + pokedexEntryId: pokedexEntry._id, + haveToEvolve: false, + caught: false, + inHome: false, + hasGigantamaxed: false, + personalNotes: '' + }; + } const dispatch = createEventDispatcher(); function updateCatchRecord() { - dispatch('updateCatch', { pokedexEntry, catchRecord: workingCatchRecord }); + dispatch('updateCatch', { pokedexEntry, catchRecord }); } @@ -87,7 +89,7 @@ Caught: @@ -100,7 +102,7 @@ Needs to evolve: @@ -113,7 +115,7 @@ In home: @@ -127,7 +129,7 @@ Has Gigantamaxed: @@ -141,7 +143,7 @@ for={`personalNotesInput-${catchRecord?._id || pokedexEntry._id}`}>Notes: