Skip to content

fix(home): show book autocomplete popup only for the selected tab#489

Merged
kdroidFilter merged 1 commit into
masterfrom
fix/home-autocomplete-duplicate-popup
Jun 14, 2026
Merged

fix(home): show book autocomplete popup only for the selected tab#489
kdroidFilter merged 1 commit into
masterfrom
fix/home-autocomplete-duplicate-popup

Conversation

@kdroidFilter

Copy link
Copy Markdown
Owner

Summary

Fixes a duplicate book-autocompletion popup on the Home page (reported as the "כפול" / double popup).

Root cause:

  • The suggestion state is owned by a single shared SearchHomeViewModel, but every open tab stays composed permanently (non-selected tabs are measured with layout(0, 0) {} so they draw nothing).
  • A Popup renders in its own window and escapes that layout(0, 0) trick. So whenever suggestionsVisible = true, every composed tab whose SearchBar is in reference mode drew its own popup window → two identical popups overlapping at different anchors.

Fix:

  • Gate the suggestions overlay in SearchBar on LocalTabSelected.current, so only the currently selected tab renders the popup. Reuses the existing LocalTabSelected composition local already used elsewhere for per-tab gating.

Test plan

  • Open two Home tabs, type a book query in one → only one popup appears
  • Switch tabs while the popup is open → popup follows the active tab, no duplicate
  • Single Home tab still shows suggestions and book/category/TOC picking works as before

The suggestion state lives in a single shared SearchHomeViewModel while every
open tab stays composed. Since a Popup renders in its own window and escapes the
layout(0,0) trick that hides non-selected tabs, each composed tab drew a
duplicate suggestions popup. Gate the overlay on LocalTabSelected so only the
active tab renders it.
@kdroidFilter kdroidFilter merged commit f67a7fe into master Jun 14, 2026
7 checks passed
@kdroidFilter kdroidFilter deleted the fix/home-autocomplete-duplicate-popup branch June 14, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant