Skip to content

Refactor cloud mode v2 history menu.#10863

Merged
abhishekp106 merged 2 commits into
masterfrom
abhishek/cloud_mode_history_menu_refactor
May 14, 2026
Merged

Refactor cloud mode v2 history menu.#10863
abhishekp106 merged 2 commits into
masterfrom
abhishek/cloud_mode_history_menu_refactor

Conversation

@abhishekp106
Copy link
Copy Markdown
Contributor

Description

Fixes REMOTE-1669 and fixes APP-4450.

Refactors the history menu to remove a layer of indirection that makes supporting new features easier and also eliminates a crash that Aloke experienced (only once ever).

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

https://www.loom.com/share/7499f85761234f559cedbef62f5a89d9

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot cla-bot Bot added the cla-signed label May 13, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 13, 2026

@abhishekp106

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@abhishekp106 abhishekp106 requested a review from liliwilson May 13, 2026 23:34
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This refactors the cloud-mode V2 history menu to use InlineMenuView directly and adds compact/dismiss-on-click options to the shared inline menu view.

Concerns

  • The cloud-mode history menu no longer closes/restores the composer when pressing Down on the last item or when there are no results.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment on lines 151 to 153
pub fn select_down(&self, ctx: &mut ViewContext<Self>) {
self.inner.update(ctx, |v, ctx| v.select_down(ctx));
self.menu_view.update(ctx, |v, ctx| v.select_down(ctx));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] This wraps from the last row back to the first instead of closing/restoring the history menu like InlineHistoryMenuView::select_down did; Down on the last item (or with no results) should still emit Close.

Suggested change
pub fn select_down(&self, ctx: &mut ViewContext<Self>) {
self.inner.update(ctx, |v, ctx| v.select_down(ctx));
self.menu_view.update(ctx, |v, ctx| v.select_down(ctx));
}
pub fn select_down(&self, ctx: &mut ViewContext<Self>) {
let should_close = self.menu_view.read(ctx, |v, _| {
let result_count = v.result_count();
let is_last_item_selected =
result_count > 0 && v.selected_idx().is_some_and(|idx| idx == result_count - 1);
is_last_item_selected || result_count == 0
});
if should_close {
ctx.emit(InlineHistoryMenuEvent::Close);
} else {
self.menu_view.update(ctx, |v, ctx| v.select_down(ctx));
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 here, should we reuse the select_down from InlineHistoryMenuView?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

make select down great again

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it kinda gets mucky with re-using it because then the InlineHistoryMenuView needs to be aware of when to have select down close and when to have it wrap (it wraps currently). It was a very small change to have the cloud mode history view handle it so I went with that

Copy link
Copy Markdown
Contributor

@liliwilson liliwilson left a comment

Choose a reason for hiding this comment

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

Love me a good refactor

Comment on lines 151 to 153
pub fn select_down(&self, ctx: &mut ViewContext<Self>) {
self.inner.update(ctx, |v, ctx| v.select_down(ctx));
self.menu_view.update(ctx, |v, ctx| v.select_down(ctx));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 here, should we reuse the select_down from InlineHistoryMenuView?

@abhishekp106 abhishekp106 enabled auto-merge (squash) May 14, 2026 17:37
@abhishekp106 abhishekp106 merged commit f6faaf0 into master May 14, 2026
28 checks passed
@abhishekp106 abhishekp106 deleted the abhishek/cloud_mode_history_menu_refactor branch May 14, 2026 17:53
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->

Fixes REMOTE-1669 and fixes APP-4450.

Refactors the history menu to remove a layer of indirection that makes
supporting new features easier and also eliminates a crash that Aloke
experienced (only once ever).

## Linked Issue
<!--
Link the GitHub issue this PR addresses. Before opening this PR, please
confirm:
-->
- [ ] The linked issue is labeled `ready-to-spec` or
`ready-to-implement`.
- [ ] Where appropriate, screenshots or a short video of the
implementation are included below (especially for user-visible or UI
changes).

## Testing
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see WARP.md for more
details on how to get set up.
-->

- [x] I have manually tested my changes locally with `./script/run`

### Screenshots / Videos
<!-- Attach screenshots or a short video demonstrating the change, where
appropriate. Remove this section if it is not relevant to your PR. -->

https://www.loom.com/share/7499f85761234f559cedbef62f5a89d9

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants