Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughDev-server renders can use a template’s exported ChangesPreview Props
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant DevServer
participant getRendered
participant Renderer.render
participant TemplateModule
participant createSSRApp
DevServer->>getRendered: Request template render
getRendered->>Renderer.render: Pass source and preview=true
Renderer.render->>TemplateModule: Load component and previewProps
TemplateModule-->>Renderer.render: Return default component and previewProps
Renderer.render->>createSSRApp: Pass component and selected props
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Development previews can use template sample props without changing regular rendering. No actionable merge-blocking issue is identified; merge after normal checks pass. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Normal rendering and builds do not automatically use sample values, even when sharing resources with development previews. Development test emails do use those values. Remaining uncertainty concerns development-server exposure and reuse of mutable sample objects. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (2 skipped: 2 unsupported.)
✨ 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 |
Implements request in discussion #1802, which was converted from an issue in #1799.
On the dev server, templates that take props are currently given
undefinedasservenever passes props, causing previews to show up incorrectly or with blank values as well as warnings being spammed to the log whenever an email with props is previewed.As the discussion mentions,
withDefaults()is not a good solution, as it means that any sample props could potentially leak into production emails if they're accidentally left missing.This PR introduces a way of showing sample prop data on the dev server via exporting it from a plain
<script>block:Only the dev server ever uses the exported
previewProps.render()ignore them, as proven by the new test inserve.test.ts.I attempted to run the formatter as given in the contributing guidelines, but no script seemed to exist. I know CONTRIBUTING says to ask before working on significant features, but a discussion for this already exists albeit with no replies. I'm happy to rework this if needed.
Screenshots:


Summary by CodeRabbit
previewProps. Values passed directly to a render take precedence.