Skip to content

Commit ef0d2d4

Browse files
committed
fix(mobile): restore search only when the header changes
1 parent 28df4c3 commit ef0d2d4

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/mobile/src/features/home/HomeHeader.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ export function HomeHeader(props: HomeHeaderProps) {
3434
});
3535
// UIKit swaps search fields when the Duo header changes modes. Restore the
3636
// current filter without reapplying text on each keystroke.
37+
const previousSidebarHeader = useRef(sidebarHeader);
3738
useEffect(() => {
38-
if (usesDuoWorkspace) restoreSearchText();
39-
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Header mode changes replace the native search field.
39+
const headerChanged = previousSidebarHeader.current !== sidebarHeader;
40+
previousSidebarHeader.current = sidebarHeader;
41+
if (usesDuoWorkspace && headerChanged) restoreSearchText();
4042
}, [sidebarHeader, usesDuoWorkspace]);
4143
useEffect(
4244
() =>

‎apps/mobile/src/native/use-native-mail-search-toolbar.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useNativeLayoutMetrics } from "./native-layout-metrics";
22
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native-glass";
33

4-
/** Horizontal native bars use the mail-style filter and compose toolbar. */
4+
/** Folded phones keep search in the bottom toolbar; expanded Duo panes use the side bar. */
55
export function useNativeMailSearchToolbar() {
66
const metrics = useNativeLayoutMetrics();
77
return (

0 commit comments

Comments
 (0)