Skip to content

fix(web): fully clear diff route state when closing panel#953

Open
copypasteitworks wants to merge 1 commit intopingdotgg:mainfrom
copypasteitworks:pr/diff-toggle-close
Open

fix(web): fully clear diff route state when closing panel#953
copypasteitworks wants to merge 1 commit intopingdotgg:mainfrom
copypasteitworks:pr/diff-toggle-close

Conversation

@copypasteitworks
Copy link

@copypasteitworks copypasteitworks commented Mar 12, 2026

Summary

This also targets the diff-panel close bug addressed in #937. I noticed that PR after preparing this one, so if that approach is preferred this PR can be closed.

This affects both browser and desktop builds because the diff panel state is driven by the same web route/search logic.

This version differs in two ways:

  • it clears the full diff route state on close, not just diff
  • it adds a focused regression test for removing diff search state from the active thread route

Closes #931
Closes #935

Repro

  1. Open a thread.
  2. Open the diff panel.
  3. Try to close it with the close button.
  4. On narrow layouts, try dismissing it by clicking the overlay.

Actual on main

The route keeps diff=1, so the diff panel does not really close.

Root Cause

The thread route retains the diff search param at the route level, so explicit close navigation that strips diff params is immediately overridden by retained search state.

What This Changes

  • removes route-level diff search retention from the thread route
  • keeps shared diff search validation through the thread route search options
  • adds a regression test proving stripDiffSearchParams(previous) removes diff route state from the active thread route

Why This Differs From #937

#937 fixes the stuck-open symptom by unsetting diff, but leaves diffTurnId and diffFilePath behind.

This PR clears all diff route params on close, which keeps the URL and route state fully in sync after dismissing the panel.

Testing

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run test -- src/threadRouteSearch.test.ts
  • manually verified on main that:
    • close button does not close the diff panel
    • overlay dismiss does not close the diff panel on narrow layouts
  • manually verified on this branch that both close paths work

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a4308e8b-8169-4f1d-a274-c72c33e1d00a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@github-actions github-actions bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Mar 12, 2026
@ByQwank
Copy link

ByQwank commented Mar 12, 2026

Merge already!! this has been driving me nuts today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] I can't close the View diff sidepanel? [BUG] Diff panel toggle doesn't hide the diff panel

3 participants