Skip to content

fix: hide model dropdown popup on unmount - #468

Open
ThunderTr77 wants to merge 2 commits into
TouchAI-org:mainfrom
ThunderTr77:fix/model-dropdown-popup-unmount-cleanup
Open

fix: hide model dropdown popup on unmount#468
ThunderTr77 wants to merge 2 commits into
TouchAI-org:mainfrom
ThunderTr77:fix/model-dropdown-popup-unmount-cleanup

Conversation

@ThunderTr77

@ThunderTr77 ThunderTr77 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Hide the active model dropdown popup when its composable unmounts.
  • Add a regression test for the open-popup unmount cleanup path.

Related issue or RFC

Related to https://github.com/TouchAI-org/TouchAI

AI assistance disclosure

  • Tool(s) used: AI assistant
  • Scope of assistance: bug identification, patch drafting, and local verification
  • Human review or rewrite performed: reviewed the diff and test output before publishing
  • Architecture or boundary impact: none

Testing evidence

Vitest targeted: tests/composables/SearchView/useModelDropdownPopup.test.ts --pool=threads passed (7 tests)
Prettier check passed for the changed files
git diff --check passed

pnpm test:pr did not run locally because the Windows environment only exposed pnpm through Corepack and the Git hook expected a direct pnpm shim. CI is expected to provide the full proof for the broader suite.

Risk notes

  • AgentService, runtime, MCP, or schema impact: none
  • database baseline or migration impact: none
  • release or packaging impact: none

Screenshots or recordings

Not applicable; this is popup lifecycle cleanup covered by unit tests.

Checklist

  • The PR title follows Conventional Commits and is valid for squash merge.
  • This PR is either ready for review or explicitly marked as a Draft PR.
  • I did not use [WIP] or similar title prefixes.
  • If AI materially assisted this PR, I disclosed the tools and scope and I personally reviewed every affected change.
  • I can explain the why, what, and how of this change without relying on an AI tool.
  • If this touches AgentService, runtime, MCP, or schema boundaries, there is an accepted RFC.
  • If this changes architecture or adds a new cross-boundary abstraction, there is an accepted RFC.
  • I ran pnpm test:pr for this code PR, or this is a docs-only change.
  • If I changed Rust behavior or tests, I reviewed pnpm test:coverage:rust or relied on CI coverage evidence.
  • If I changed desktop startup/window/search/popup/settings/E2E paths, I ran pnpm test:e2e locally or documented why CI is the first valid proof.
  • I added tests or explained why tests are not appropriate.
  • I updated docs when behavior changed.

@github-actions github-actions Bot added the area:frontend Frontend UI or view-layer changes label Jun 15, 2026
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ThunderTr77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7f13dc6d-838b-4b81-83f8-0f8b85c588a7

📥 Commits

Reviewing files that changed from the base of the PR and between f3f700d and 594532c.

📒 Files selected for processing (2)
  • apps/desktop/src/views/SearchView/composables/useModelDropdownPopup.ts
  • apps/desktop/tests/composables/SearchView/useModelDropdownPopup.test.ts
📝 Walkthrough

Walkthrough

The onUnmounted teardown in useModelDropdownPopup now pre-captures closingIdentity and a shouldHidePopup flag before resetting state, then calls popupManager.hide conditionally with a catch for error logging. A new test verifies popupManager.hide is invoked with the correct identity and onPopupSessionEnd fires once when the composable unmounts while open.

Changes

Conditional popup hide on unmount

Layer / File(s) Summary
Teardown guard logic and test coverage
apps/desktop/src/views/SearchView/composables/useModelDropdownPopup.ts, apps/desktop/tests/composables/SearchView/useModelDropdownPopup.test.ts
onUnmounted now snapshots closingIdentity and shouldHidePopup before clearing state, calls popupManager.hide only when both conditions are met, and wraps the call in a catch that logs failures. The new test asserts the correct identity arguments and a single onPopupSessionEnd invocation when unmounting with an open popup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 When the popup must close and I hop away,
I'll peek at the identity before the reset day,
Only hide if it's needed — no reckless goodbye,
And catch any errors that tumble from the sky.
A tidy teardown, tested with care — hooray! 🌼

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format with the 'fix:' prefix, is concise and clear, and accurately describes the main change of hiding the model dropdown popup on unmount.
Description check ✅ Passed The description includes all required sections: Summary, Related issue, AI assistance disclosure with full details, Testing evidence explaining local limitations, Risk notes, and a comprehensive checklist. Minor item unchecked is explained by local environment constraints with CI as fallback.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 15, 2026
@hiqiancheng

Copy link
Copy Markdown
Collaborator

还漏了 popupManager.show() pending 时组件卸载的清理场景。

Please handle unmount while popupManager.show() is still pending.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 21 days. Please update it or leave a note if it is still in progress.

@github-actions github-actions Bot added the Stale label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Frontend UI or view-layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants