fix: isolate goober pragma from host app to prevent react-hot-toast crash - #630
Merged
hitesh-shetty-cstk merged 1 commit intoJul 29, 2026
Merged
Conversation
…rash VisualBuilder called goober's setup(h) with Preact's h at init, which mutates goober's shared global pragma. A host app that also uses a goober-backed library such as react-hot-toast then renders through that pragma, emitting Preact elements into a React 19 tree and crashing with "A React Element from an older version of React was rendered." The SDK only uses goober's css/glob/keyframes, none of which read the pragma, and never uses styled (the sole pragma consumer). setup(h) was therefore inert for the SDK and only leaked into the host. Removing it restores the pragma-free behavior the SDK shipped with before the call was introduced. Co-Authored-By: Claude <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
hitesh-shetty-cstk
force-pushed
the
fix/goober-shared-instance-react19-crash
branch
from
July 29, 2026 10:19
041c500 to
e44b9e5
Compare
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
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.
What
Visual Builder called goober's
setup(h)with Preact'shduring init.setup()sets goober's global, shared element pragma. Because goober is a singleton hoisted across the host app's dependency tree, this flips the pragma for every goober consumer in the page, not just the SDK.A host app that pairs the SDK with a goober-backed UI library such as
react-hot-toastthen renders through that Preact pragma. On React 19 the emitted elements carry the legacy element brand and React rejects them:The result is a white screen the moment a toast (or any goober
styledcomponent) mounts, only inside Live Preview / Visual Builder.Fix
Remove the
setup(h)call and its now-unusedsetup/himports.The SDK only uses goober's
css,glob, andkeyframes, none of which read the pragma. It never usesstyled, the sole consumer of the pragma. Sosetup(h)did nothing for the SDK's own styling and only leaked Preact'shinto the host's shared goober instance. Removing it restores the pragma-free behavior the SDK used before this call was added, and stops the SDK from touching host-app goober state at all.Why it is safe
styledusage anywhere in the SDK source (the only API that needs the pragma).css/glob/keyframescompute class names and inject sheets without the pragma.extractCssusage; nocss()called with a function argument (the only path that reads context props).setupbefore this call existed.Testing
Symbol(react.transitional.element)before and after SDK init, instead of flipping toSymbol(react.element).npm run buildpasses.css, confirming styling still works.🤖 Generated with Claude Code