Sync losos/html.js cache-validity fix from upstream (#15 / linkedobjects/losos#16)#4
Merged
Merged
Conversation
linkedobjects/losos#16 added a `container.firstChild` guard to the patch fast-path in `render()`, so a stale cache after the container was wiped externally falls through to a fresh build instead of silently no-op'ing on detached nodes. Mirror the upstream change into the vendored copy at `losos/html.js`. Net diff: 2 lines, +90 bytes. Fixes source-pane going blank after tab-switching in the LOSOS shell.
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
Mirrors
linkedobjects/losos#16into the vendoredlosos/html.jscopy.The upstream fix added a
container.firstChildguard before taking the patch fast-path inrender(). Without it, after the container's children were cleared externally (e.g. the LOSOS shell doescontent.innerHTML = ''between tab switches), the cache still hit andpatch()updated detached nodes — visible as blank source-pane after tab-switching in this repo.2 lines changed, +90 bytes.
Test plan
node -c losos/html.jssyntax passes.localhost:4443/..., switch Sharing → Source → Sharing → Source — source-pane renders consistently every time. Was: blank after the second visit. Now: works.firstChildis truthy when ANY rendered child remains, so templates with zero${}holes still hit the patch shortcut on rerender.Out of scope
losos/in this repo and depending on@linkedobjects/lososfrom npm — separate concern, mirrors the duplicate-source issue tracked atlinkedobjects/losos#17.