Repository navigation
fix(app): skip legacy MedicalAsset accounts in technician jobs fetch #52 - #60
Merged
Merged
Conversation
…52) fetchAllAssets used program.account.medicalAsset.all([]), whose internal decode throws RangeError on accounts minted by an older program layout (58 bytes, predating maintenance_reward/failure_count vs the current 70-byte struct) - killing the entire fetch even when valid accounts exist. Replaced with a raw getProgramAccounts call using the same memcmp discriminator filter, a size guard to skip legacy accounts, and per-account decoding via program.coder.accounts.decode. fetchHospitalAssets is untouched - it already scopes by hospital and never hit this path.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Summary
Cierra el issue #52. El fetch de "Available Jobs" en el dashboard del técnico fallaba silenciosamente por dos causas combinadas: el RPC público de Devnet cerraba conexiones en llamadas pesadas de getProgramAccounts, y una vez resuelto eso, el decode de Anchor crasheaba con RangeError al toparse con 2 cuentas legacy de un layout de programa anterior (58 bytes vs los 70 actuales).
Changes
assetDiscovery.ts: fetchAllAssets ahora usa getProgramAccounts crudo con el mismo filtro memcmp que usaba.all(), un guard de tamaño que descarta cuentas legacy, y decode por cuenta individual. fetchHospitalAssets no fue tocado.WalletProvider.tsx: RPC endpoint configurable vía VITE_RPC_URL (Helius), con fallback al público.main.tsx: polyfill de Buffer para bn.js/@solana/web3.js en el navegador.Testing
tsc --noEmit: sin errores.Notes
Closes #52