[#207] Chain Plot flow with storyline selector#66
Conversation
- Create /chain route with storyline selector and content textarea - Implement useChainPlot hook reusing PublishState type from usePublish - Same 5-state flow: uploading -> confirming -> pending -> indexing -> published - Fetch writer's active (non-sunset) storylines via react-query - Wire Filebase upload + chainPlot() + plot indexer with content fallback - CID cache with content hash validation (same pattern as usePublish) - Link to "Create one" when writer has no active storylines Fixes #207 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The chain-plot page is generally wired up, but it does not satisfy the key implementation requirement to reuse the existing P3-2 publishing state machine. Instead, the PR duplicates nearly the entire flow in a new hook.
Findings
- [medium]
useChainPlotduplicates the create-storyline publish logic instead of reusing the existing publishing state machine as requested.- File:
src/hooks/useChainPlot.ts:1 - Suggestion: Extract the shared upload / tx-confirm / indexing flow into a reusable hook or helper used by both create-storyline and chain-plot paths, then keep only the operation-specific contract/indexer parameters separate.
- File:
Decision
Requesting changes because the PR misses a core acceptance criterion for P3-3: reuse the P3-2 publishing state machine rather than reimplementing it.
project7-interns
left a comment
There was a problem hiding this comment.
T2b Review: APPROVED
Chain Plot flow mirrors the Create Storyline pattern cleanly. Findings:
- Storyline selector — queries writer's active (non-sunset, non-hidden) storylines via react-query. Empty state links to
/create. Dropdown shows title + plot count. useChainPlothook — reusesPublishStatetype fromusePublish, same 5-state flow, CID cache with content hash validation. CallschainPlot()withBigInt(storylineId)— correct for Solidity uint256.- IPFS key namespacing —
plotlink/plots/{storylineId}-{timestamp}.txtvs genesis'splotlink/genesis/{timestamp}.txt. Good separation. - Indexer wiring — triggers
/api/index/plotwith txHash + content fallback. Correct per §4.1 spec. - Published state — "View story" links to the storyline page, "Chain another" resets. Clean UX.
- CI green.
No issues found.
- Refactor usePublish into a generic hook accepting PublishOptions (content, uploadKeyPrefix, indexerRoute, buildWriteCall) - useChainPlot now delegates to usePublish (no duplicated logic) - Update create page to use usePublish directly with storyline-specific config - Same 5-state flow, CID cache, and error handling shared across both Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
T2b Re-review: APPROVED
Great refactor — shared state machine eliminates duplication. Findings:
usePublish— now generic withPublishOptions(content,uploadKeyPrefix,indexerRoute,buildWriteCall). All flow logic (CID cache, state transitions, receipt waiting, indexer call) lives in one place.useChainPlot— thin 33-line wrapper passing chainPlot-specific config tousePublish.execute(). Clean separation.create/page.tsx— updated to useusePublish().execute()with inlinebuildWriteCall. No moreusePublishStoryline— single source of truth.WriteCallinterface — typed withAbi,0x${string}address,readonly unknown[]args. Theas unknown as []cast in the create page is a pragmatic workaround for wagmi's strict abi generics.txHashmanaged viauseState— no longer fromuseWriteContract().data, which fixes potential stale ref issues.- CI green.
No issues found.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The follow-up resolves the design issue by extracting a shared usePublish state machine that both create-storyline and chain-plot flows now use. The repository check is passing.
Findings
- None.
Decision
Approving because the chain-plot implementation now satisfies the P3-3 requirement to reuse the existing publishing state machine rather than duplicating it, and the rest of the flow remains aligned with the current upload, RPC, and indexer setup.
Summary
/chainroute with storyline selector and content textareauseChainPlothook reusingPublishStatetype fromusePublishchainPlot()+ plot indexer with content fallbackFiles Changed
src/app/chain/page.tsx— Chain plot form with storyline dropdownsrc/hooks/useChainPlot.ts— Publishing hook for chainPlot()Test plan
tsc --noEmitpasseseslintpassesFixes #207
🤖 Generated with Claude Code