Fix Rich Markdown embeds becoming broken links in isolated view after save#5588
Draft
FadhlanR wants to merge 1 commit into
Draft
Fix Rich Markdown embeds becoming broken links in isolated view after save#5588FadhlanR wants to merge 1 commit into
FadhlanR wants to merge 1 commit into
Conversation
… save A card/file embed inserted into a RichMarkdownField previewed correctly in the compose editor but rendered as a broken link in the saved isolated view. The compose editor resolves refs via a live getCards search, while the saved isolated/embedded view resolves only through the query-backed linkedCards / linkedFiles relationships. That query field's search resource is cached per field-instance and reused unconditionally. When the field is first read in edit mode, getStore returns a FallbackCardStore whose getSearchResource hands back a permanently-empty, non-updating resource (and a just-created card's refs aren't resolved yet). The isolated render then reuses that inert resource and shows the embed as broken. ensureQueryFieldSearchResource now records whether a resource was built against the fallback store or before its query resolved, and rebuilds it once a real store / resolvable query is available. This is a one-shot transition that never fires while still on the fallback store (no loop) and leaves the prerender seed path untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Preview deploymentsHost Test Results 1 files 1 suites 2h 44m 54s ⏱️ Results for commit 073989e. For more details on these errors, see this check. Realm Server Test Results 1 files 1 suites 15m 1s ⏱️ Results for commit 073989e. For more details on these errors, see this check. |
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.
Background and Goal
A card/file embed inserted into a
RichMarkdownFieldpreviews correctly in the compose editor but renders as a broken link in the saved isolated/embedded view (CS-12111). This fixes that so a just-added embed resolves in the saved view exactly as it did in compose.Where to start
packages/base/query-field-support.ts—ensureQueryFieldSearchResource. The reuse branch now rebuilds an inert cached resource; provenance is recorded at creation.packages/base/card-api.gts—FallbackCardStoregains anisFallbackCardStorebrand so the query-field layer can recognize the storeless fallback.Key decisions and non-obvious mechanics
getCardssearch, while the saved isolated view resolves only through the query-backedlinkedCards/linkedFilesrelationships. That query field's search resource is cached per field-instance and reused unconditionally. When the field is first read in edit mode,getStorereturns aFallbackCardStorewhosegetSearchResourcehands back a permanently-empty, non-updating resource (and a just-created card's refs aren't resolved yet). The isolated render then reuses that inert resource → broken link.$this.*query resolved, and rebuild it once a real store / resolvable query is available. It's a one-shot transition — it never fires while still on the fallback store (no loop), and the prerender seed path is untouched.:card[...]→ save → isolated now renders the embed resolved (no broken-link box). Regression test added atpackages/host/tests/acceptance/markdown-embed-save-isolated-test.gtscovering both card and file embeds.🤖 Generated with Claude Code