fix(configurator): live preview now reacts to panel changes - #424
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR changes how override CSS is embedded and how preview iframes reload. Preview panes now use per-frame load counters to gate style updates, and the new-tab action rebuilds iframe HTML from the current settings. ChangesPreview override CSS flow
Sequence Diagram(s)sequenceDiagram
participant App as App.svelte
participant Panel as PreviewPanel.svelte
participant Frame as iframe document
App->>App: assign fa(...) output to style#sf-parent-overrides
Panel->>Panel: buildIframeHTML(overrides, previewTheme, previewMotion, previewTemplate, frameworkCSSStatic)
Panel->>Frame: load preview HTML with style#slashed-overrides
Frame-->>Panel: onload increments loadCount or split load counts
Panel->>Frame: set style#slashed-overrides textContent
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix configurator live preview updates after panel changes Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
5 rules 1. Blob URL not revoked
|
Two root-cause bugs:
1. Double-wrapped :root{} in slashed-overrides style element — fa() with
mode:"root" already returns a complete :root{...} block, but both
buildIframeHTML and the patch effects wrapped it in a second :root{}.
With CSS nesting in modern browsers the inner :root is interpreted as
:root :root (descendant selector) which matches nothing, so no token
ever applied.
2. html/$derived included `overrides`, so every token change triggered a
full srcdoc reload that raced with the patch effect and discarded its
work. Now srcdoc only encodes template/motion/theme (structural
changes), and the effects own all override + theme patching.
Also replace the loaded boolean with loadCount counters so the patch
effect correctly re-runs after any iframe reload (template/motion/theme
changes), not just after the first load.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExUMnARDWD8897H8MzctkF
Bundle size badge regenerated as a side-effect of running npm run build to verify the configurator fix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExUMnARDWD8897H8MzctkF
194b2de to
d01f442
Compare
The build script still emits CSS to dist/ locally even after the badges/ rename (PR #425). Add dist/ to .gitignore so stale build artifacts don't show up as untracked files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExUMnARDWD8897H8MzctkF
Two root-cause bugs:
Double-wrapped :root{} in slashed-overrides style element — fa() with
mode:"root" already returns a complete :root{...} block, but both
buildIframeHTML and the patch effects wrapped it in a second :root{}.
With CSS nesting in modern browsers the inner :root is interpreted as
:root :root (descendant selector) which matches nothing, so no token
ever applied.
html/$derived included
overrides, so every token change triggered afull srcdoc reload that raced with the patch effect and discarded its
work. Now srcdoc only encodes template/motion/theme (structural
changes), and the effects own all override + theme patching.
Also replace the loaded boolean with loadCount counters so the patch
effect correctly re-runs after any iframe reload (template/motion/theme
changes), not just after the first load.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01ExUMnARDWD8897H8MzctkF
Summary by CodeRabbit