fix frameRendering with all extensions#478
fix frameRendering with all extensions#478ExtraBinoss wants to merge 2 commits intowebadderallorg:mainfrom
Conversation
📝 WalkthroughWalkthroughThis PR adds device frame overlay support to the video renderer. Frame assets are configured via ChangesDevice Frame Overlay Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/exporter/frameRenderer.ts (1)
1419-1448: ⚡ Quick winRedundant dynamic import of
extensionHost.
extensionHostis already imported at the top of the file (line 58). The dynamic import here is unnecessary and adds overhead.♻️ Proposed fix
private async setupFrame(): Promise<void> { const frameId = this.config.frame; if (!frameId) return; - const { extensionHost } = await import("@/lib/extensions/extensionHost"); const frames = extensionHost.getFrames(); const frame = frames.find((f) => f.id === frameId);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/exporter/frameRenderer.ts` around lines 1419 - 1448, The setupFrame method currently does a redundant dynamic import of extensionHost; remove the await import line and use the already-imported extensionHost (referenced at top of the file) directly when calling extensionHost.getFrames(), leaving the rest of setupFrame logic unchanged (keep using frame.screenInsets, frame.draw, frame.filePath, frameImage, frameDraw as-is); ensure no other references expect a locally destructured extensionHost variable and update any such usage to the module-level extensionHost.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/lib/exporter/frameRenderer.ts`:
- Around line 1419-1448: The setupFrame method currently does a redundant
dynamic import of extensionHost; remove the await import line and use the
already-imported extensionHost (referenced at top of the file) directly when
calling extensionHost.getFrames(), leaving the rest of setupFrame logic
unchanged (keep using frame.screenInsets, frame.draw, frame.filePath,
frameImage, frameDraw as-is); ensure no other references expect a locally
destructured extensionHost variable and update any such usage to the
module-level extensionHost.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 44a4b905-9102-493b-9f6c-261552416a04
📒 Files selected for processing (2)
src/lib/exporter/frameRenderer.tssrc/lib/exporter/modernFrameRenderer.ts
Summary
Fix frame renderer integration to use extension-host registered frames globally
Why
The current behavior can look like frame rendering is tied to the built-in
borders-framesextension, but the intended architecture is extension-agnostic.Both export paths (
FrameRendererandModernFrameRenderer) should resolve frames from the shared extension host registry so any active extension that registers frames viaapi.registerFrame(...)works consistently.This PR clarifies and aligns that behavior so frame rendering is not perceived as custom logic for a single extension.
What this changes
extensionHost.getFrames().drawcallback frames (resolution-independent rendering)screenInsetsusage so preview and export layout remain consistent.Expected impact
uipermission that registers frames can be rendered in preview and export. - No special-case dependency onpublic/builtin-extensions/borders-frames.Type of Change
Video (wherever possible):
export-lighnting-frame_DjT5v1JT.mp4
Testing Guide
Any extension with a rendering in the canvas, like my border extension.
Checklist
Thank you for contributing!
Summary by CodeRabbit