Repository navigation
fix(share): give gallery cards their share slots and embed only the cards a canvas shows - #89
Merged
Merged
Conversation
…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.
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.
Fixes two faults in the share move to dfo-apis (#77).
sharedFrominsrc/content/gallery/index.ts) refresh each card through/api/share/<id>/cards/<cardId>/refresh, with no?slot=.slotRefreshResponseanswers 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.tsxnow passesslots: liveSlotsOf(saved).liveSlotsOf(src/lib/chat/sharePayload.ts) takes the slots fromslotCanvas(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,slotCanvasover the canvas the prod/s/<id>page serves gives the same slots as over the gallery copy, andsharePayload.test.tspins them.EmbedViewdrew 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 snapshotChartCardorTableCardthrew on its bare widget. The embed now listscanvasWidgetsOf(saved), the rule/s/<id>andslotCanvasfollow, 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 typecheckandpnpm lintpass.sharePayload.test.ts,slotCards.test.tsandliveCards.test.tspass (43). The database tests run in CI.