feat(editor): ensure EmailTheming presence in Inspector.Provider#3175
feat(editor): ensure EmailTheming presence in Inspector.Provider#3175gabrielmfern wants to merge 3 commits intocanaryfrom
Conversation
Throws an error when Inspector.Provider is rendered without the EmailTheming extension registered on the editor. This gives developers a clear message instead of silently returning null in Inspector.Document. Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/editor/src/ui/inspector/provider.tsx">
<violation number="1" location="packages/editor/src/ui/inspector/provider.tsx:134">
P2: This invariant check is delayed to `useEffect`, so the provider can render once without `EmailTheming` before throwing. Keep this validation in render to fail fast.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Summary
Adds a runtime validation check in
Inspector.Providerthat throws an error if theEmailThemingextension is not registered on the editor. Previously, if a developer forgot to addEmailThemingto their editor extensions, theInspector.Documentcomponent would silently returnnull, making it difficult to debug. Now, a clear error message is thrown instructing the user to add the extension.Changes
packages/editor/src/ui/inspector/provider.tsx: Added a check at the top ofInspectorProviderthat verifies the'theming'extension (i.e.EmailTheming) is present in the editor's extension manager. If missing, throws anErrorwith an actionable message.This follows the existing validation pattern used in
useInspector,useBubbleMenuContext, anduseNodeSelectorContextwhich throw errors for missing providers/contexts.Slack Thread
Summary by cubic
Add a runtime validation in
Inspector.Providerto ensure the editor registersEmailTheming. If missing, we throw a clear error instead ofInspector.Documentreturningnull.'theming'extension during render usingeditor.extensionManager.extensions, and throw an actionable error if missing.Written for commit b43b4d0. Summary will update on new commits.