Skip to content

fix(catalog/ios): hide "Showing X of Y items" label when search overlay is active#1894

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-catalog-search-overlay-issue
Draft

fix(catalog/ios): hide "Showing X of Y items" label when search overlay is active#1894
Copilot wants to merge 3 commits intomainfrom
copilot/fix-catalog-search-overlay-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

  • Investigate the issue - "Showing X of Y items" label peeks below iOS search bar overlay
  • Fix: Hide ListHeaderComponent when searchValue has text (searchValue.length === 0 check)
  • Address CodeRabbit feedback: also gate on !isSearching to prevent brief re-appearance during 400ms debounce window when user clears search
Original prompt

This section details on the original issue you should resolve

<issue_title>iOS – Catalog Search Overlay Shows "Showing X of Y Items" Label Peeking</issue_title>
<issue_description>Description:
On iOS, when using the Catalog search:

  • Tapping the search icon overlays the search results screen correctly.
  • However, the “Showing X of Y items” label peeks between the search bar and the results overlay, partially visible.

This creates a visual layering issue, making the UI appear broken or misaligned.

Steps to Reproduce:

  1. Open the app on iOS
  2. Navigate to the Catalog screen
  3. Tap the Search icon
  4. Observe the overlay and the “Showing X of Y items” label

Screenshots / Screen Recordings:

Image

Expected Result:
The search overlay should completely cover the Catalog items and associated labels; no underlying text should peek through.

Actual Result:
The “Showing X of Y items” label is partially visible between the search bar and the results overlay.

Environment:

  • Device: iPhone (13 Pro)

Additional Notes:

  • This is iOS-specific</issue_description>

Comments on the Issue (you are @copilot in this section)

@andrew-bierman @copilot Assigned for POC development. Please investigate and create a proof of concept implementation.

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed header display to hide during search mode, providing a cleaner search experience.
    • Corrected item count display to only show when results are available.

Co-authored-by: andrew-bierman <94939237+andrew-bierman@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix visibility issue with catalog search overlay on iOS fix(catalog/ios): hide "Showing X of Y items" label when search overlay is active Mar 9, 2026
@andrew-bierman
Copy link
Collaborator

@coderabbitai Please review this PR for code quality, best practices, and potential issues.

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd "CatalogItemsScreen.tsx" --exec cat {}

Length of output: 9809


@andrew-bierman The PR description image clearly shows the bug: "Showing 20 of 197,717 items" peeking through the search overlay while "Sh" is typed in the search bar. The fix is correct and well-reasoned. Here's the full review:


✅ Fix Assessment

The core change — gating ListHeaderComponent on searchValue.length === 0 instead of isSearching — is the right call. Using the raw atom value means the label unmounts immediately on the first keystroke, well ahead of the 400 ms debounce. The semantic reasoning (paginated stats are irrelevant during vector search) is also sound.


🔴 Critical – Potential Runtime Crash: searchResults is not null-safe

// Line ~35
const searchResults = vectorResult?.items;

searchResults can be undefined when vectorResult has not yet resolved. Two call sites crash without a guard:

// Line ~111 — TypeError if searchResults is undefined
{searchResults.length > 0 && (
  <Text>...</Text>
)}

// Line ~118 — TypeError if searchResults is undefined
{searchResults.map((item: CatalogItem) => (

The isVectorLoading check above only gates the spinner; once loading finishes (including on error before data populates), searchResults can still be undefined.

Suggested fix:

const searchResults = vectorResult?.items ?? [];

This is a one-character change and eliminates all downstream null checks.


🟡 Medium – Unused Destructured Value

isFetching: _isVectorFetching,

This is destructured but never used. If it was retained for future use, a comment would help. Otherwise it should be removed to keep the destructuring clean:

// Remove this line entirely, or add a comment explaining intent

🟡 Medium – CategoriesFilter Remains Visible During Search

When the iOS search overlay is active, the CategoriesFilter bar (rendered between LargeTitleHeader and FlatList) is still visible and interactive. It likely also peeks through or sits beneath the overlay depending on z-ordering. Consider conditionally hiding it the same way:

{searchValue.length === 0 && (
  <CategoriesFilter
    data={categories}
    onFilter={setActiveFilter}
    activeFilter={activeFilter}
    error={categoriesError}
    retry={refetchCategories}
    className="px-4 py-2"
  />
)}

🟢 Minor – Unnecessary Computation When Searching

totalItemsText and showingText are computed on every render even when searchValue.length > 0 (and thus never rendered). While not a performance concern at this scale, you could wrap them in the same guard condition or use useMemo with a searchValue.length === 0 dependency.


Summary

Severity Issue
🔴 Critical searchResults is not null-safe — will crash when vectorResult is undefined
🟡 Medium _isVectorFetching destructured but unused
🟡 Medium CategoriesFilter still visible during search overlay
🟢 Minor Stats computed unnecessarily while searching

The fix is correct and targets the right layer of the problem. Addressing the searchResults ?? [] null-safety issue before merging is strongly recommended.

@andrew-bierman
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

The CatalogItemsScreen now conditionally renders its header based on search state. When a user searches (searchValue is not empty), the header and "Showing X of Y items" label are completely hidden to prevent visual overlap with the search overlay, resolving the visual layering issue.

Changes

Cohort / File(s) Summary
Search UI Visibility Fix
apps/expo/features/catalog/screens/CatalogItemsScreen.tsx
Modified ListHeaderComponent to hide the header and "Showing X of Y items" label when searchValue is not empty, preventing the label from peeking through the search overlay on iOS. Header now renders conditionally based on search state, with showingText only appearing when not searching and items are present.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A hop through the catalog, search's sweet call,
No pesky labels peeking at all,
When searching takes flight, we hide from sight,
The UI now sits just perfectly right!

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses the core visual layering issue (hiding the label) but leaves critical safety issues unresolved: missing null-safety checks on searchResults and unused destructuring. Add null-safety guard: const searchResults = vectorResult?.items ?? []; and remove or document the unused _isVectorFetching destructure before merging.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive The changes are narrowly scoped to the ListHeaderComponent visibility gate. However, the review identifies that CategoriesFilter should also be hidden during search overlay, which may be considered an incomplete fix. Clarify whether hiding CategoriesFilter during search is within scope; if so, add a conditional hide using the same searchValue.length === 0 guard.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: hiding the 'Showing X of Y items' label when search is active on iOS.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/fix-catalog-search-overlay-issue

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/expo/features/catalog/screens/CatalogItemsScreen.tsx`:
- Around line 200-209: The header currently bases visibility on raw searchValue
which remounts immediately; change it to use the debounced/search-overlay flag
so it stays hidden until the debounce window closes. In CatalogItemsScreen
replace the condition that uses searchValue.length === 0 with the debounced
indicator (isSearching or the debouncedSearchValue check used by the overlay) so
the header’s render (the View containing totalItemsText and showingText) is
keyed off the same "search overlay visible" signal as the overlay, ensuring the
header remains hidden while isSearching is true and only shows after debouncing
completes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e99200f1-eb60-4613-8c92-62675ca72f1e

📥 Commits

Reviewing files that changed from the base of the PR and between 3f94763 and e0f6e54.

📒 Files selected for processing (1)
  • apps/expo/features/catalog/screens/CatalogItemsScreen.tsx

Comment on lines +200 to +209
searchValue.length === 0 ? (
<View className="mb-4">
<View className="flex-row items-center justify-between">
<Text className="text-muted-foreground">{totalItemsText}</Text>
</View>
{paginatedItems.length > 0 && (
<Text className="mt-1 text-xs text-muted-foreground">{showingText}</Text>
)}
</View>
{paginatedItems.length > 0 && (
<Text className="mt-1 text-xs text-muted-foreground">{showingText}</Text>
)}
</View>
) : null
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep the header hidden until the debounce window closes.

Line 200 keys the header off raw searchValue, but the overlay above still keys off debounced isSearching. When the user clears the field, this remounts the header immediately while the search overlay can remain visible for another 400ms, so the same peek-through can briefly reappear.

Minimal fix
-          searchValue.length === 0 ? (
+          searchValue.length === 0 && !isSearching ? (
             <View className="mb-4">
               <View className="flex-row items-center justify-between">
                 <Text className="text-muted-foreground">{totalItemsText}</Text>
               </View>
               {paginatedItems.length > 0 && (
                 <Text className="mt-1 text-xs text-muted-foreground">{showingText}</Text>
               )}
             </View>
           ) : null

Longer-term, it would be safer to drive both the overlay content and the hidden-underlay state from the same “search overlay visible” signal.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
searchValue.length === 0 ? (
<View className="mb-4">
<View className="flex-row items-center justify-between">
<Text className="text-muted-foreground">{totalItemsText}</Text>
</View>
{paginatedItems.length > 0 && (
<Text className="mt-1 text-xs text-muted-foreground">{showingText}</Text>
)}
</View>
{paginatedItems.length > 0 && (
<Text className="mt-1 text-xs text-muted-foreground">{showingText}</Text>
)}
</View>
) : null
searchValue.length === 0 && !isSearching ? (
<View className="mb-4">
<View className="flex-row items-center justify-between">
<Text className="text-muted-foreground">{totalItemsText}</Text>
</View>
{paginatedItems.length > 0 && (
<Text className="mt-1 text-xs text-muted-foreground">{showingText}</Text>
)}
</View>
) : null
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/expo/features/catalog/screens/CatalogItemsScreen.tsx` around lines 200 -
209, The header currently bases visibility on raw searchValue which remounts
immediately; change it to use the debounced/search-overlay flag so it stays
hidden until the debounce window closes. In CatalogItemsScreen replace the
condition that uses searchValue.length === 0 with the debounced indicator
(isSearching or the debouncedSearchValue check used by the overlay) so the
header’s render (the View containing totalItemsText and showingText) is keyed
off the same "search overlay visible" signal as the overlay, ensuring the header
remains hidden while isSearching is true and only shows after debouncing
completes.

@andrew-bierman
Copy link
Collaborator

@copilot Please address the CodeRabbit review feedback on this PR (1 inline comments).

@andrew-bierman
Copy link
Collaborator

@copilot CodeRabbit has reviewed this PR. Please address the feedback.

1 similar comment
@andrew-bierman
Copy link
Collaborator

@copilot CodeRabbit has reviewed this PR. Please address the feedback.

@andrew-bierman
Copy link
Collaborator

@copilot Reminder: please address the CodeRabbit review feedback on this PR.

…ch is cleared

Co-authored-by: andrew-bierman <94939237+andrew-bierman@users.noreply.github.com>
@andrew-bierman
Copy link
Collaborator

@copilot CodeRabbit has reviewed this PR. Please address the feedback.

@andrew-bierman
Copy link
Collaborator

@coderabbitai review

@andrew-bierman
Copy link
Collaborator

@copilot CodeRabbit has reviewed this PR. Please address the feedback.

1 similar comment
@andrew-bierman
Copy link
Collaborator

@copilot CodeRabbit has reviewed this PR. Please address the feedback.

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.

iOS – Catalog Search Overlay Shows "Showing X of Y Items" Label Peeking

2 participants