Commit 5bb7018
authored
Fix diff button when Show code review button toggle is off (warpdotdev#9600)
Closes warpdotdev#9196.
### Description
Two `show_code_review_button` gates were dropping panel-open requests on
the floor when the user had hidden the toolbar button:
**1. Data-path gate at `Workspace::setup_code_review_panel`
(`view.rs:7982`)**
```rust
if !*TabSettings::as_ref(ctx).show_code_review_button {
return;
}
```
`update_right_panel_open_state` calls into this whenever the right panel
is being opened (chip click, `Shift+Cmd+=` keybinding, etc.), so the
early return silently swallowed every explicit user action.
**2. Render-path gate at `Workspace::render_config_panel` and
`render_config_panel_maximized` (`view.rs:18981` / `19040`)**
```rust
if !item.is_available(app) || !item.is_panel() { return None; }
…
if !HeaderToolbarItemKind::CodeReview.is_available(app) { return None; }
```
`HeaderToolbarItemKind::is_available` for `CodeReview` returns
`*TabSettings::as_ref(app).show_code_review_button.value()`
(`header_toolbar_item.rs:89`). So even after fix #1 set
`pane_group.right_panel_open = true` and `setup_code_review_panel` ran,
the next render frame saw `is_available() == false` and returned `None`
— the `right_panel_view` was never added to the layout.
This second gate is what @moirahuang flagged when their local repro
still showed nothing happening after the first fix landed. The data was
correct; the panel was just never composed into the UI.
### Fix
1. **Drop the early return at `setup_code_review_panel`.** The setting
is meant to gate only the toolbar button's visibility (already enforced
correctly by `header_toolbar_item.rs::is_available`, which feeds
`render_header_toolbar_button` at `view.rs:17276`).
2. **Switch panel-render call sites from `is_available` →
`is_supported`.** `is_available`'s own doc-comment says it's
specifically *"Whether this item should be shown in the **toolbar** —
checks both `is_supported` and user show/hide preferences."* Using it to
gate panel rendering conflates two unrelated concerns. Panel rendering
should only care about whether the feature is compiled in
(`is_supported`), not whether the user has hidden the toolbar button.
For `CodeReview`, `is_supported` is `cfg!(feature = "local_fs")`. For
the other variants in the same match (`TabsPanel`, `ToolsPanel`),
`is_available` already equals `is_supported` (default `_ => true` arm in
the inner match), so behaviour is unchanged. `AgentManagement` and
`NotificationsMailbox` return `None` unconditionally inside
`render_config_panel`, so the change is moot for them too.
### Caller audit for `setup_code_review_panel`
5 call sites in `view.rs`:
1. `view.rs:3681` — `TransferredTab` flow, only runs when the source tab
already had `right_panel_open == true`.
2. `view.rs:8136` — `update_right_panel_open_state` with `should_open ==
true`. **The diff-button path** that warpdotdev#9196 is about.
3. `view.rs:13372` — `PaneFocused` event, gated on `right_panel_open`
already true.
4. `view.rs:13490` — `RepoChanged` event, gated on `right_panel_open`
already true.
5. `view.rs:14458` — session env update, gated on `right_panel_open`
already true.
None of these need the `show_code_review_button` gate — they're either
explicit user actions or gated on `right_panel_open` already being open.
The toolbar button toggle continues to do its job at
`render_header_toolbar_button` independently.
### Testing
Reproduced @moirahuang's test locally on macOS 26.4.1 (Apple Silicon)
against `WarpOss.app` built from this branch:
1. Settings → "Show code review button" → **OFF**
2. `echo "x" >> README.md` inside a git repo
3. Click the diff stats chip on the prompt (`+1 -0`)
**Result:** Code review panel opens on the right showing the diff, while
the toolbar button stays hidden — exactly the expected behaviour from
issue warpdotdev#9196. Inverse case (toggle ON) also verified: toolbar button
visible, panel still works the same.
- `cargo fmt -p warp -- --check` passes.
- `cargo nextest` skipped locally — Metal toolchain unavailable on my
machine, mirroring warpdotdev#9277. CI will exercise the change.
### Server API
No server changes.
### Agent Mode
Not applicable.
### Changelog Entries
`CHANGELOG-BUG-FIX`: The diff button on the terminal prompt now opens
the code review panel even when the toolbar's "Show code review button"
toggle is disabled (regression from a recent release).
Co-authored-by: anshul-garg27 <13553550+anshul-garg27@users.noreply.github.com>1 parent ad21d67 commit 5bb7018
3 files changed
Lines changed: 74 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7988 | 7988 | | |
7989 | 7989 | | |
7990 | 7990 | | |
7991 | | - | |
7992 | | - | |
7993 | | - | |
7994 | | - | |
7995 | 7991 | | |
7996 | 7992 | | |
7997 | 7993 | | |
| |||
18294 | 18290 | | |
18295 | 18291 | | |
18296 | 18292 | | |
| 18293 | + | |
| 18294 | + | |
| 18295 | + | |
| 18296 | + | |
| 18297 | + | |
| 18298 | + | |
| 18299 | + | |
| 18300 | + | |
| 18301 | + | |
| 18302 | + | |
| 18303 | + | |
| 18304 | + | |
18297 | 18305 | | |
18298 | 18306 | | |
18299 | 18307 | | |
| |||
18924 | 18932 | | |
18925 | 18933 | | |
18926 | 18934 | | |
| 18935 | + | |
| 18936 | + | |
| 18937 | + | |
| 18938 | + | |
| 18939 | + | |
| 18940 | + | |
| 18941 | + | |
| 18942 | + | |
| 18943 | + | |
| 18944 | + | |
| 18945 | + | |
| 18946 | + | |
18927 | 18947 | | |
18928 | 18948 | | |
18929 | 18949 | | |
| |||
18983 | 19003 | | |
18984 | 19004 | | |
18985 | 19005 | | |
18986 | | - | |
| 19006 | + | |
18987 | 19007 | | |
18988 | 19008 | | |
18989 | 19009 | | |
| |||
18992 | 19012 | | |
18993 | 19013 | | |
18994 | 19014 | | |
18995 | | - | |
| 19015 | + | |
18996 | 19016 | | |
18997 | 19017 | | |
18998 | 19018 | | |
| |||
19038 | 19058 | | |
19039 | 19059 | | |
19040 | 19060 | | |
19041 | | - | |
| 19061 | + | |
19042 | 19062 | | |
19043 | 19063 | | |
19044 | 19064 | | |
| |||
0 commit comments