Fix opening FileDef cards from prerendered search results in the stack in interact mode#4072
Fix opening FileDef cards from prerendered search results in the stack in interact mode#4072jurgenwerk wants to merge 3 commits intomainfrom
Conversation
When clicking a prerendered FileDef card (e.g. embedded format), the system defaulted to type 'card' because the store had no cached file-meta data for prerendered results. This caused a 415 Unsupported Media Type error when the stack item tried to load the URL as a card. The fix flows isFileMeta from the server response through to a data-card-type="file" attribute on the rendered element, then uses it as a fallback in the overlay type detection when the store-based detection fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d79c35ba67
ℹ️ 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".
packages/host/app/components/operator-mode/operator-mode-overlays.gts
Outdated
Show resolved
Hide resolved
Preview deployments |
Replace the data-card-type DOM attribute approach with a module-level Set (knownFileMetaUrls) to avoid card HTML content spoofing the attribute and causing misclassification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3d1d854ad
ℹ️ 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".
| if (docs.some((doc) => doc.meta?.isFileMeta)) { | ||
| combined.meta.isFileMeta = true; |
There was a problem hiding this comment.
Preserve per-result file-meta type when merging realms
combinePrerenderedSearchResults promotes isFileMeta to a single response-level boolean when any realm marks it true, which loses typing information in federated responses. In _federated-search-prerendered this merged meta is consumed by the host (prerendered-search.ts) and applied to every returned card, so a mixed multi-realm query (one realm resolved as file-meta, another as card) will misclassify normal cards as files and break overlay actions/open behavior for those cards.
Useful? React with 👍 / 👎.
Summary
detectStackItemTypeForTarget()defaults to'card'for prerendered FileDef URLs because the store has no cached file-meta data — the card was only fetched as pre-rendered HTML, never loaded into the storeisFileMetafrom the server's prerendered search response through to adata-card-type="file"attribute on the rendered DOM element, then uses it as a fallback in the overlay type detectionHow it works
Server side: When
searchPrerendereddetects a file-meta query, it now includesisFileMeta: truein the response meta.Client side:
PrerenderedCardreads this flag and setsdata-card-type="file"on the rendered HTML element. The overlay'sgetTypeForCardTarget()checks this attribute as a fallback when the store-based detection returns'card'.🤖 Generated with Claude Code