fix(sdk): invalidate stale screen asset URLs on edit and prioritize revision screens (#361) - #378
Open
davideast wants to merge 1 commit into
Conversation
…evision screens (#361)
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.
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 ($\rightarrow$ $\rightarrow$ $\rightarrow$
generategetHtmleditgetHtml), two SDK-level cache/ordering issues causededited.getHtml()to return unchanged pre-edit HTML:htmlCode/screenshotcache retention on in-place edits: Callingawait screen.getHtml()cachesthis.data.htmlCode.downloadUrlon theScreeninstance inEntityManager. Whenscreen.edit()returned the updatedScreenwithout an inlinehtmlCode.downloadUrl,mergeEntityDatakept the pre-edithtmlCode.downloadUrl, causingedited.getHtml()to short-circuit on the cache and return the pre-edit URL without callingget_screen.outputComponents: Whenedit_screensreturns both the originalselectedScreenIdsscreen (s1) and a newly minted revision screen (s2) inoutputComponents[].design.screens[],Generation.first(edited.getHtml()) pointed tos1(original) instead ofs2(edited revision).Changes
EntityManager.prototype.invalidateScreenAssets(projectId, screenId): Clears cachedhtmlCodeandscreenshotfields on mutated screens beforeEntityManager.resolvemerges theedit_screens/apply_design_systemresponse.StitchToolClient.prototype.reconcileEditedScreens(): Automatically invalidates stale asset URLs forselectedScreenIdsand orders newly minted revision screens ahead of originalselectedScreenIdsinoutputComponents[].design.screens[].