fix(desktop): set webview src via JSX prop to prevent null-src crash on mount#407
fix(desktop): set webview src via JSX prop to prevent null-src crash on mount#407
Conversation
📝 WalkthroughWalkthroughThe PR refactors how the webview component applies attributes by moving the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
specs/current/sentry/troubleshooting.md (1)
10-12: Make endpoint snippets directly runnable.Lines 10, 21, 116, and 127 show raw
GETpaths inbashblocks, which are easy to copy incorrectly during incidents. Prefer fullcurlcommands for consistency with the rest of the guide.💡 Suggested doc update
-```bash -GET /api/0/issues/{issue_id}/ -``` +```bash +curl -sS \ + -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \ + "https://sentry.io/api/0/issues/{issue_id}/" +``` -```bash -GET /api/0/issues/{issue_id}/events/latest/ -``` +```bash +curl -sS \ + -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \ + "https://sentry.io/api/0/issues/{issue_id}/events/latest/" +``` -```bash -GET /api/0/issues/{issue_id}/events/?limit=10 -``` +```bash +curl -sS \ + -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \ + "https://sentry.io/api/0/issues/{issue_id}/events/?limit=10" +``` -```bash -GET /api/0/issues/{issue_id}/events/{event_id}/ -``` +```bash +curl -sS \ + -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \ + "https://sentry.io/api/0/issues/{issue_id}/events/{event_id}/" +```Also applies to: 20-22, 116-117, 127-128
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@specs/current/sentry/troubleshooting.md` around lines 10 - 12, Replace the raw "GET /api/0/..." bash block snippets with runnable curl examples that include the full https://sentry.io URL, the Authorization header using $SENTRY_AUTH_TOKEN, and -sS for silent/verbose errors; specifically update the snippets that show "GET /api/0/issues/{issue_id}/", "GET /api/0/issues/{issue_id}/events/latest/", "GET /api/0/issues/{issue_id}/events/?limit=10", and "GET /api/0/issues/{issue_id}/events/{event_id}/" to use curl -sS with -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" and the full endpoint URL so readers can copy-paste and run them directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@specs/current/sentry/troubleshooting.md`:
- Line 137: Update the phrasing under the "**Response size**" note that
currently states "the full event JSON is large (40–50KB)" to a less rigid claim
such as "can be large (often tens of KB or more)" so it reflects variability
from attachments, frames, breadcrumbs, and integrations; locate the sentence
labeled "**Response size**" in sentry/troubleshooting.md and replace the numeric
range with the suggested, more general wording.
- Around line 94-95: Replace the hardcoded timestamp window in the breadcrumb
filtering example (the jq expression using map(select(.timestamp >=
"2026-03-22T06:20" and .timestamp <= "2026-03-22T06:35"))) with placeholders or
shell variables (e.g., START/END or TIMESTAMP_START/TIMESTAMP_END) and update
the surrounding text to show how to set those variables before running the
command so the example remains evergreen; keep the jq expression reference
(map(select(.timestamp >= ... and .timestamp <= ...))) so readers can locate and
substitute the variables.
---
Nitpick comments:
In `@specs/current/sentry/troubleshooting.md`:
- Around line 10-12: Replace the raw "GET /api/0/..." bash block snippets with
runnable curl examples that include the full https://sentry.io URL, the
Authorization header using $SENTRY_AUTH_TOKEN, and -sS for silent/verbose
errors; specifically update the snippets that show "GET
/api/0/issues/{issue_id}/", "GET /api/0/issues/{issue_id}/events/latest/", "GET
/api/0/issues/{issue_id}/events/?limit=10", and "GET
/api/0/issues/{issue_id}/events/{event_id}/" to use curl -sS with -H
"Authorization: Bearer $SENTRY_AUTH_TOKEN" and the full endpoint URL so readers
can copy-paste and run them directly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8bf6bb04-b7f8-489e-bc9e-87ea2f1ba695
📒 Files selected for processing (2)
apps/desktop/src/components/surface-frame.tsxspecs/current/sentry/troubleshooting.md
|
/cr |
|
✅ CR topic created in Feishu topic group Refly CR. |
Relates to #510
What
Set the
srcattribute on<webview>via JSX prop instead of imperatively in a ref callback.Why
Fixes a crash reported in Sentry (issue #406):
Error processing argument at index 0, conversion failure from null.When
<webview>is inserted into the DOM, Electron firesconnectedCallbacksynchronously. Inside that hook, Electron callsWebViewImpl.createGuest→SrcAttribute.parse(this.getAttribute('src')). Becausesrcwas previously set imperatively via a ref callback (which runs after DOM insertion), the attribute was null at the moment Electron read it, causing the native binding to throw.How
Move
src={src}into the JSX so the attribute is present on the element beforeconnectedCallbackfires. The ref callback now only handlespreload, which is a custom attribute that still needssetAttribute.Affected areas
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpassespnpm generate-typesrun (if API routes/schemas changed)anytypes introduced (useunknownwith narrowing)Summary by CodeRabbit