Skip to content

fix: hide model dropdown popup on unmount#468

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

fix: hide model dropdown popup on unmount#468
ThunderTr77 wants to merge 1 commit 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2d3002c2-66f1-497b-9f36-c360d5f557d5

📥 Commits

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

📒 Files selected for processing (2)
  • apps/desktop/src/views/SearchView/composables/useModelDropdownPopup.ts
  • apps/desktop/tests/composables/SearchView/useModelDropdownPopup.test.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Desktop E2E Smoke (Windows)
  • GitHub Check: Frontend Quality
  • GitHub Check: Frontend Tests
  • GitHub Check: Rust Checks
  • GitHub Check: CodeQL (rust)
🔇 Additional comments (2)
apps/desktop/src/views/SearchView/composables/useModelDropdownPopup.ts (1)

207-229: LGTM!

apps/desktop/tests/composables/SearchView/useModelDropdownPopup.test.ts (1)

219-242: LGTM!


📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Enhanced search dropdown cleanup and state management during unmount operations.
    • Added error handling for popup closure operations.
  • Tests

    • Added test coverage for search dropdown session cleanup on unmount.

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

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.

1 participant