Skip to content

fix(desktop): ReviewパネルのURLをSupersetブラウザペインで開く#35

Merged
MocA-Love merged 4 commits intomainfrom
fix/review-panel-url-open
Mar 30, 2026
Merged

fix(desktop): ReviewパネルのURLをSupersetブラウザペインで開く#35
MocA-Love merged 4 commits intomainfrom
fix/review-panel-url-open

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Mar 30, 2026

Summary

  • ReviewタブのCommentsでURLをクリックするとアプリ全体がそのURLを開いてしまうバグを修正
  • comment.url(コメントのGitHubリンク)、pr.url(PRタイトルリンク)、ReactMarkdown内のリンク全てを対象に修正
  • useWorkspaceId() をコンテキストから直接取得し、addBrowserTab で新規ブラウザタブにURLを開くよう変更
  • <a href> タグをElectronのナビゲーションが確実に発生しない <button> に変更
  • 既存のブラウザペインのURLが置き換えられないよう、常に新規タブで開く

Test plan

  • ReviewタブのCommentsでコメントURLボタン(↗アイコン)をクリック → 新規ブラウザタブで開かれることを確認
  • PRタイトルリンクをクリック → 新規ブラウザタブで開かれることを確認
  • Markdownコメント本文内のリンクをクリック → 新規ブラウザタブで開かれることを確認
  • 既存のブラウザタブのURLが置き換えられないことを確認

ReviewタブのCommentsでURLをクリックするとアプリ全体がそのURLを開いてしまう
バグを修正。WorkspaceIdContextから直接workspaceIdを取得し、openInBrowserPane
でSupersetのブラウザペインにURLを開くよう変更。

- comment.url、pr.url、ReactMarkdown内のリンク全てに対応
- useWorkspaceId()をコンテキストから直接取得(props経由のnullish値問題を回避)
@MocA-Love MocA-Love self-assigned this Mar 30, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

Modified ReviewPanel component to route anchor clicks through openInBrowserPane using resolved workspace ID instead of default browser behavior. Updated Fish shell test expectations to include a new prompt marker hook function.

Changes

Cohort / File(s) Summary
Link Routing in ReviewPanel
apps/desktop/src/renderer/.../ReviewPanel.tsx
Added memoized handleOpenUrl handler that prevents default link behavior and routes clicks through openInBrowserPane(resolvedWorkspaceId, url). Updated PR link, comment link, and Markdown-rendered anchor click handling to use this centralized handler. Removed target="_blank" and rel="noopener noreferrer" from anchor elements.
Shell Wrapper Test Updates
apps/desktop/src/main/lib/agent-setup/shell-wrappers.test.ts
Updated expected Fish shell --init-command strings in two tests to include _superset_prompt_marker hook function that registers on fish_prompt event and outputs escape sequence \033]777;superset-prompt\007.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hops through tabs with newfound grace,
Links now route to their rightful place,
No more wandering, browser panes aligned,
Workspace-aware, by design! 🌐✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR description is in Japanese and lacks required template structure; description details are provided but sections don't match English template format. Use the provided English description template with sections: Description, Related Issues, Type of Change, Testing, Screenshots, and Additional Notes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title is in Japanese and describes opening URLs in Superset's browser pane from the Review panel, which directly matches the main change in ReviewPanel.tsx (routing URL handling through openInBrowserPane).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/review-panel-url-open

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx (1)

828-828: The workspaceId prop may now be redundant.

ReviewPanel now calls useWorkspaceId() directly from context (line 64 in ReviewPanel.tsx) and uses contextWorkspaceId ?? workspaceId for resolution. Since ChangesView is rendered within the same WorkspaceIdContext provider, contextWorkspaceId will always have the correct value, making the prop fallback unnecessary.

Consider removing the prop if the context is always available here. However, keeping it provides a defensive fallback if the component is ever used outside the context.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx`
at line 828, Remove the now-redundant workspaceId prop: update the ChangesView
usage to stop passing workspaceId and remove the workspaceId prop from the
ChangesView component signature and its PropType/TypeScript interface; ensure
any internal references to props.workspaceId are switched to using
useWorkspaceId() (or rely on ReviewPanel's resolution which already uses
useWorkspaceId()) and delete any fallback logic that used the passed-in
workspaceId; verify related tests/types that referenced the prop are updated
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx`:
- Around line 67-76: The click handler handleOpenUrl currently always calls
e.preventDefault()/e.stopPropagation(), which blocks native navigation when
resolvedWorkspaceId is falsy; change it so you first check resolvedWorkspaceId
and only call e.preventDefault()/e.stopPropagation() and
openInBrowserPane(resolvedWorkspaceId, url) when resolvedWorkspaceId is truthy,
otherwise allow the event to proceed (or explicitly open the URL with
window.open(url, '_blank') if you want a programmatic fallback); update the
useCallback body for handleOpenUrl accordingly so links remain functional when
resolvedWorkspaceId is unavailable.

---

Nitpick comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx`:
- Line 828: Remove the now-redundant workspaceId prop: update the ChangesView
usage to stop passing workspaceId and remove the workspaceId prop from the
ChangesView component signature and its PropType/TypeScript interface; ensure
any internal references to props.workspaceId are switched to using
useWorkspaceId() (or rely on ReviewPanel's resolution which already uses
useWorkspaceId()) and delete any fallback logic that used the passed-in
workspaceId; verify related tests/types that referenced the prop are updated
accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d174a7a6-8890-4d99-a2ae-e64924910620

📥 Commits

Reviewing files that changed from the base of the PR and between d23d665 and 043efc5.

📒 Files selected for processing (2)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx

- ReviewPanelのworkspaceId propを削除し、useWorkspaceId()で直接取得するよう整理
- shell-wrappers.test.tsのfishテストスナップショットを_superset_prompt_marker追加に合わせて更新
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx (1)

64-73: The if (resolvedWorkspaceId) guard is unnecessary.

Based on the useWorkspaceId() implementation in WorkspaceIdContext.tsx, the hook throws an error when the context value is null rather than returning a falsy value. This means resolvedWorkspaceId is guaranteed to be a valid string whenever this component renders successfully.

The guard at line 68 is dead code since the condition will always be true. You can simplify by removing it:

♻️ Suggested simplification
 const handleOpenUrl = useCallback(
   (url: string, e: React.MouseEvent) => {
     e.preventDefault();
     e.stopPropagation();
-    if (resolvedWorkspaceId) {
-      openInBrowserPane(resolvedWorkspaceId, url);
-    }
+    openInBrowserPane(resolvedWorkspaceId, url);
   },
   [resolvedWorkspaceId, openInBrowserPane],
 );

Note: The previous review comment about links becoming non-functional when resolvedWorkspaceId is falsy does not apply here—that scenario cannot occur given the hook's behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx`
around lines 64 - 73, The if-check guarding resolvedWorkspaceId inside the
handleOpenUrl callback is dead code because useWorkspaceId() (from
WorkspaceIdContext) throws if the context is missing and therefore
resolvedWorkspaceId is always a valid string; remove the unnecessary conditional
in the useCallback (function handleOpenUrl) and call
openInBrowserPane(resolvedWorkspaceId, url) directly after preventing
default/stopPropagation, keeping the same dependency array
([resolvedWorkspaceId, openInBrowserPane]) and behavior otherwise.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx`:
- Around line 64-73: The if-check guarding resolvedWorkspaceId inside the
handleOpenUrl callback is dead code because useWorkspaceId() (from
WorkspaceIdContext) throws if the context is missing and therefore
resolvedWorkspaceId is always a valid string; remove the unnecessary conditional
in the useCallback (function handleOpenUrl) and call
openInBrowserPane(resolvedWorkspaceId, url) directly after preventing
default/stopPropagation, keeping the same dependency array
([resolvedWorkspaceId, openInBrowserPane]) and behavior otherwise.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ddcfaa88-ffc2-42d0-8143-469d2ce2fb61

📥 Commits

Reviewing files that changed from the base of the PR and between 043efc5 and 671291b.

📒 Files selected for processing (2)
  • apps/desktop/src/main/lib/agent-setup/shell-wrappers.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx

@MocA-Love MocA-Love merged commit ce64372 into main Mar 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant