Skip to content

fix(sdk): invalidate stale screen asset URLs on edit and prioritize revision screens (#361) - #378

Open
davideast wants to merge 1 commit into
fix/issue-149-list-screens-fallbackfrom
fix/issue-361-edit-screen-freshness
Open

davideast wants to merge 1 commit into
fix/issue-149-list-screens-fallbackfrom
fix/issue-361-edit-screen-freshness

Conversation

@davideast

Copy link
Copy Markdown
Collaborator

Summary

Resolves the SDK-side root causes of #361 (Tier 2 — Part 2 of 3 in stack, stacked on #377).

When a caller runs the iterative design loop (generate $\rightarrow$ getHtml $\rightarrow$ edit $\rightarrow$ getHtml), two SDK-level cache/ordering issues caused edited.getHtml() to return unchanged pre-edit HTML:

  1. Stale htmlCode / screenshot cache retention on in-place edits: Calling await screen.getHtml() caches this.data.htmlCode.downloadUrl on the Screen instance in EntityManager. When screen.edit() returned the updated Screen without an inline htmlCode.downloadUrl, mergeEntityData kept the pre-edit htmlCode.downloadUrl, causing edited.getHtml() to short-circuit on the cache and return the pre-edit URL without calling get_screen.
  2. Original vs. revision ordering in outputComponents: When edit_screens returns both the original selectedScreenIds screen (s1) and a newly minted revision screen (s2) in outputComponents[].design.screens[], Generation.first (edited.getHtml()) pointed to s1 (original) instead of s2 (edited revision).

Changes

  • EntityManager.prototype.invalidateScreenAssets(projectId, screenId): Clears cached htmlCode and screenshot fields on mutated screens before EntityManager.resolve merges the edit_screens / apply_design_system response.
  • StitchToolClient.prototype.reconcileEditedScreens(): Automatically invalidates stale asset URLs for selectedScreenIds and orders newly minted revision screens ahead of original selectedScreenIds in outputComponents[].design.screens[].

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