fix: marketplace — snapshot héros en fallback RPC (Héros introuvable) - #388
Merged
Merged
Conversation
… introuvable' Root cause : list_hero_for_sale cherchait le héros dans player_heroes (cloud), mais les héros peuvent être uniquement en localStorage (pas encore sync). - Nouvelle migration : list_hero_for_sale accepte p_hero_snapshot comme fallback quand le héros n'est pas dans player_heroes - useMarketplace.ts : useCreateListing accepte heroSnapshot optionnel - MarketplacePage.tsx : construit et passe le snapshot au hook - CreateListingModal.tsx : onConfirm retourne aussi le héros complet Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Root cause
list_hero_for_salecherchait le héros dans la tableplayer_heroes(cloud Supabase), mais les héros peuvent exister uniquement en localStorage si la synchronisation cloud n'a pas encore eu lieu.→ RPC retournait
{ success: false, error: 'Héros introuvable.' }à chaque tentative de mise en vente.Fix
SQL (nouvelle migration
20260322180000_fix_marketplace_hero_snapshot.sql)list_hero_for_saleaccepte maintenant un 4ème paramètre optionnelp_hero_snapshot JSONB DEFAULT NULL:player_heroes→ utilise les données DB (sécurisé)p_hero_snapshotfourni → utilise le snapshot client (fallback)Frontend
useCreateListingaccepteheroSnapshot?: MarketplaceHeroSnapshotMarketplacePageconstruit le snapshot depuis l'objet Hero local et le passe au hookCreateListingModal.onConfirmretourne maintenant(heroId, price, hero)au lieu de(heroId, price)Ou coller le SQL de
supabase/migrations/20260322180000_fix_marketplace_hero_snapshot.sqldirectement dans le SQL Editor Supabase.Test plan
npm run build✓🤖 Generated with Claude Code