🐞 Patch Stoplight mosaic storage fallback#2416
Open
JFWooten4 wants to merge 3 commits intostellar:mainfrom
Open
🐞 Patch Stoplight mosaic storage fallback#2416JFWooten4 wants to merge 3 commits intostellar:mainfrom
JFWooten4 wants to merge 3 commits intostellar:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a patch-package patch for @stoplight/mosaic@1.53.4 to make Mosaic’s theme persistence more resilient in SSR/non-browser and partial Storage API environments.
Changes:
- Add
removeItemto Mosaic’s in-memory storage fallback. - Avoid reading
document.documentElementwhendocumentis unavailable. - Fall back to in-memory storage when
localStorage.removeItemis missing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move getThemeStorage above defaultMode so defaultMode cannot reference the const helper before it is initialized. This keeps the storage-backend alignment fix while avoiding a fragile declaration order in the patched Mosaic bundles.
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.
In a similar spirit to #2415, this PR fixes working environments where memory cleanup struggles. It applies a root-clear fix to actually delete the requested data. This same error fix sometimes fixes the warning while actually applying the intent, acting as a first line of defense against the build error.
Changes
This patch makes Stoplight Mosaic’s theme persistence safer in non-browser and partial-storage environments.
It adds
removeItemsupport to Mosaic’s in-memory storage fallback, avoids readingdocument.documentElementwhendocumentis unavailable, and falls back to memory storage whenlocalStorage.removeItemis missing.This prevents Mosaic’s Zustand-backed theme store from failing when rendered in environments that do not provide a complete browser storage API.