Skip to content

🐞 Patch Stoplight mosaic storage fallback#2416

Open
JFWooten4 wants to merge 3 commits intostellar:mainfrom
JFWooten4:2145-pt-42
Open

🐞 Patch Stoplight mosaic storage fallback#2416
JFWooten4 wants to merge 3 commits intostellar:mainfrom
JFWooten4:2145-pt-42

Conversation

@JFWooten4
Copy link
Copy Markdown
Contributor

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 removeItem support to Mosaic’s in-memory storage fallback, avoids reading document.documentElement when document is unavailable, and falls back to memory storage when localStorage.removeItem is missing.

This prevents Mosaic’s Zustand-backed theme store from failing when rendered in environments that do not provide a complete browser storage API.

Copilot AI review requested due to automatic review settings April 30, 2026 11:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 removeItem to Mosaic’s in-memory storage fallback.
  • Avoid reading document.documentElement when document is unavailable.
  • Fall back to in-memory storage when localStorage.removeItem is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread patches/@stoplight+mosaic+1.53.4.patch Outdated
Comment thread patches/@stoplight+mosaic+1.53.4.patch Outdated
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.
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.

2 participants