Fix opening cards in preview mode - #5684
Conversation
Card templates get their crud functions from the card-crud-functions context, which only the interact-mode stack and host mode provided. The code-mode preview pane rendered cards without it, so any in-card button that calls `viewCard` did nothing at all: the function was undefined and every call site guards with `?.`, so there was not even a console error. The Workspace card's pinned tiles are the visible case — clicking Open in the preview looked broken. The pane already had a `viewCard` of its own for the hover overlays, which navigates the code path. It now provides that through the context too, so an in-card Open behaves the same way the overlay buttons above it already do. The other crud functions stay undefined: a create, edit, or delete button remains inert here rather than doing something a read-only preview cannot honor. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1aca648f87
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @provide(CardCrudFunctionsContextName) | ||
| // @ts-ignore context is used via provider | ||
| private get cardCrudFunctions(): Partial<CardCrudFunctions> { | ||
| return { viewCard: this.args.viewCard }; |
There was a problem hiding this comment.
Provide navigation to playground previews too
When previewing an instance selected from a .gts card definition, module-inspector.gts renders Playground (lines 653–660), whose playground-preview.gts renders CardRenderer directly rather than through PreviewPanel. Consequently, this provider is not an ancestor of that card template, so controls using viewCard remain inert in the module playground; the provider needs to cover that preview path as well, with a focused test for navigation from a definition's selected instance.
Useful? React with 👍 / 👎.
burieberry
left a comment
There was a problem hiding this comment.
This is helpful but that teal color is not meant to be used by itself on light background for legibility reasons, even though ai loved to use it that way. Can we make the Open button a primary, secondary, or default boxel ui button?
I see now that this button wasn't a new addition. In that case, up to you if you want to handle in this pr. |
Clicking "Open" didn't work: