Skip to content

fix(share): give gallery cards their share slots and embed only the cards a canvas shows - #89

Merged
jm-rivera merged 2 commits into
devfrom
fix/gallery-share-slots
Oct 31, 2026
Merged

jm-rivera merged 2 commits into
devfrom
fix/gallery-share-slots

Conversation

@jm-rivera

@jm-rivera jm-rivera commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes two faults in the share move to dfo-apis (#77).

  • The four live gallery items (sharedFrom in src/content/gallery/index.ts) refresh each card through /api/share/<id>/cards/<cardId>/refresh, with no ?slot=. slotRefreshResponse answers 404 without a slot, so every card on those pages would read "This card can no longer be refreshed" once prod runs this release. src/app/(studio)/insights/gallery/[slug]/page.tsx now passes slots: liveSlotsOf(saved). liveSlotsOf (src/lib/chat/sharePayload.ts) takes the slots from slotCanvas(saved, 'live'), the function that gives a share made or imported from that canvas its slots, and throws when a shown card has no component ref, so a gallery item that cannot be live fails the build. For each of the four items, slotCanvas over the canvas the prod /s/<id> page serves gives the same slots as over the gallery copy, and sharePayload.test.ts pins them.
  • EmbedView drew every card not removed. A canvas hides an unpinned card from an older turn, and a live share holds such a card with no slot, so a live embed asked for it without a slot and showed it as failed, and after a switch to a snapshot ChartCard or TableCard threw on its bare widget. The embed now lists canvasWidgetsOf(saved), the rule /s/<id> and slotCanvas follow, for live and snapshot records alike.

Gallery card downloads change route with the slots. sharedCardAddress (src/lib/studio/cardDownload.ts) now finds a slot for each live gallery card, so a download reads /api/share/<id>/cards/<cardId>/data?slot=<n>, the frame that slot of the share holds, where it read the card's own component revision before.

Testing: pnpm typecheck and pnpm lint pass. sharePayload.test.ts, slotCards.test.ts and liveCards.test.ts pass (43). The database tests run in CI.

…ards a canvas shows

The live gallery pages refreshed each card without `?slot=`, which the slot
refresh route answers 404, so every card failed once shares moved to dfo-apis.
`liveSlotsOf` derives each card's slot with `slotCanvas`, the function that
gave the prod share its slots.

`/embed/<id>` drew every card not removed, including older-turn cards the
canvas hides. A live share holds those with no slot, so a live embed showed
them as failed and a snapshot embed crashed on them. The embed now lists
`canvasWidgetsOf`, as `/s/<id>` does.
@jm-rivera
jm-rivera merged commit b91925c into dev Oct 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant