Repository navigation
[TAS-6926] 🐛 Stop opening books with transferred token IDs - #1704
Conversation
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
Outstanding critical and moderate issues remain, including an async race where replaceStaleTokenId() can repopulate token state after reset() and an unguarded recovery path in startReaderLoad() that can leave loading state stuck if recoverLoadError throws.
2 open issues
What changed in this PR
This pull request fixes reader load failures when a user attempts to open a book using an NFT token_id they no longer own (e.g., after transferring a copy) by adding a recovery path that swaps to another owned token ID and retries the load.
Changes:
- Add a recover-and-retry hook to the reader load flow to handle
403 NOT_NFT_OWNERbefore showing the error modal. - Track and rebuild per-class token ID lists in the bookshelf store and add stale token replacement logic (with contract fallback).
- Wire recovery into both EPUB and PDF readers, with unit tests covering the new behavior.
| File | Summary |
|---|---|
test/unit/use-reader-file-load.test.ts |
Adds unit tests validating the new recover-and-retry behavior in the reader load composable. |
test/unit/bookshelf-token-ids.test.ts |
Adds unit tests for token ID list refresh/merge behavior and stale token replacement logic. |
app/stores/bookshelf.ts |
Rebuilds token ID lists on refresh and introduces replaceStaleTokenId() to drop stale IDs and find a valid replacement (including contract lookup). |
app/pages/reader/pdf.vue |
Wires PDF reader loading to attempt recovery (swap token ID) before surfacing errors. |
app/pages/reader/epub.vue |
Wires EPUB reader loading to attempt recovery (swap token ID) before surfacing errors. |
app/composables/use-reader.ts |
Implements replaceStaleNFTId() to swap the route’s nft_id to another owned copy on NOT_NFT_OWNER. |
app/composables/use-reader-file-load.ts |
Adds recoverLoadError support to attempt recovery+retry before displaying the error modal. |
This pull request requires changes.
Review effort: Balanced
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟢 Approval recommended
The change is narrowly scoped around a one-time recovery-and-retry path, is consistently wired through both EPUB and PDF reader flows, and is backed by unit tests covering the retry and token-id update behaviors.
No open issues 🎉
2 resolved since last review
Review effort: Balanced


No description provided.