Skip to content

Fix RNTester losing list search filter when navigating back (#59868) - #60504

Open
JagguDada01 wants to merge 1 commit into
react:mainfrom
JagguDada01:fix/rntester-preserve-search-filter
Open

JagguDada01 wants to merge 1 commit into
react:mainfrom
JagguDada01:fix/rntester-preserve-search-filter

Conversation

@JagguDada01

Copy link
Copy Markdown

Summary

Fixes #59868.

In RNTester, opening an example from the Components or APIs list unmounted RNTesterModuleList, causing RNTesterExampleFilter and RNTesterListFilters to lose their local filter and category state when navigating back.

This change:

  • Stores per-screen list filters (components and apis) in RNTesterNavigationReducer alongside recentlyUsed.
  • Adds optional controlled filterText / onFilterTextChange and category / onCategoryChange props to RNTesterExampleFilter and currentFilter to RNTesterListFilters, preserving uncontrolled fallback behavior.
  • Wires the active screen's filter state from RNTesterAppShared through RNTesterModuleList so search text and selected category are preserved when opening an example, switching tabs, or navigating back.
  • Preserves per-module filterText in RNTesterModuleContainer when navigating into and back from individual sub-examples (showIndividualExamples).
  • Adds Jest unit and integration tests for RNTesterAppShared, RNTesterExampleFilter, and RNTesterNavigationReducer.

Changelog

[INTERNAL] [FIXED] - Preserve RNTester list search and category filters when navigating back from an example.

Test Plan

  • Ran yarn test packages/rn-tester/:
    • 5 test suites passed, 12 tests passed (RNTesterAppShared-test.js, RNTesterExampleFilter-test.js, RNTesterNavigationReducer-test.js, SafeAreaInsetsExample-test.js, IntersectionObserverScrollMarginPrefetch-test.js).
    • New tests mock RNTesterList and RNTesterDocumentationURL to isolate navigation and filter state in Jest.
  • Ran yarn eslint packages/rn-tester/ --max-warnings 0: passed (0 errors, 0 warnings).
  • Ran yarn flow-check: Found 0 errors.
  • Ran yarn prettier --check on all 11 modified/added files: passed.
  • Not run: manual interactive verification in RNTester on iOS Simulator / Android Emulator (no booted simulator/CocoaPods setup in this environment).

This branch has not been deployed

No deployments
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.

RNTester: example list search filter resets after returning from an example

1 participant