Skip to content

Commit 420b39b

Browse files
fix(mobile): a tab hidden through a fold keeps its list's search
When the Duo folded while the other tab held a detail, that tab's list column was covered by the collapse but saw the folded search placement only on returning, after the tab switch had cleared the detail. The header kept its old search controller, which UIKit never re-placed, so the folded pull request list came back without its search. The header now gives search a new controller when the placement changes and the column was covered on either side of that change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 49a011b commit 420b39b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎apps/mobile/src/native/V5StackHeader.ios.tsx‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,17 @@ export function V5StackHeader(props: {
240240
const searchPlacement = bottomSearch ? "integrated" : (searchOptions?.placement ?? "automatic");
241241
// UIKit re-places a visible search controller when its placement changes, but not one whose
242242
// column is covered; that one needs a new controller to place once the column shows again.
243-
const [search, setSearch] = useState({ placement: searchPlacement, epoch: 0 });
244-
if (search.placement !== searchPlacement)
245-
setSearch({ placement: searchPlacement, epoch: search.epoch + (props.covered ? 1 : 0) });
243+
// A hidden tab only sees the new placement as it returns, after its detail uncovered the list.
244+
const covered = props.covered === true;
245+
const [search, setSearch] = useState({ placement: searchPlacement, covered, epoch: 0 });
246+
if (search.placement !== searchPlacement || search.covered !== covered)
247+
setSearch({
248+
placement: searchPlacement,
249+
covered,
250+
epoch:
251+
search.epoch +
252+
(search.placement !== searchPlacement && (search.covered || covered) ? 1 : 0),
253+
});
246254
const autofocusRef = searchOptions?.ref ?? searchRef;
247255
const searchHasFocus = useRef(false);
248256
useEffect(() => {

0 commit comments

Comments
 (0)