Skip to content

Conversation

@hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Sep 8, 2025

When the search query changes, we kick off a transition that updates the search query in a reducer for TreeContext. The search input is also using this value for an input HTML element.

For a larger applications, sometimes there is a noticeable delay in displaying the updated search query. This changes the approach to also keep a local synchronous state that is being updated on a change callback.

@hoxyq hoxyq requested review from eps1lon and sebmarkbage September 8, 2025 21:42
@meta-cla meta-cla bot added the CLA Signed label Sep 8, 2025
export default function ComponentSearchInput(): React.Node {
const [localSearchQuery, setLocalSearchQuery] = useState('');
const {searchIndex, searchResults} = useContext(TreeStateContext);
const transitionDispatch = useContext(TreeDispatcherContext);
Copy link
Member

Choose a reason for hiding this comment

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

We should call this dispatchAction and standardize on that everywhere.

@hoxyq hoxyq merged commit e2ba45b into facebook:main Sep 10, 2025
247 checks passed
@hoxyq hoxyq deleted the devtools/keep-search-in-a-sync-local-state branch September 10, 2025 17:38
github-actions bot pushed a commit to code/lib-react that referenced this pull request Sep 13, 2025
When the search query changes, we kick off a transition that updates the
search query in a reducer for TreeContext. The search input is also
using this value for an `input` HTML element.

For a larger applications, sometimes there is a noticeable delay in
displaying the updated search query. This changes the approach to also
keep a local synchronous state that is being updated on a change
callback.

DiffTrain build for [e2ba45b](facebook@e2ba45b)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Sep 13, 2025
When the search query changes, we kick off a transition that updates the
search query in a reducer for TreeContext. The search input is also
using this value for an `input` HTML element.

For a larger applications, sometimes there is a noticeable delay in
displaying the updated search query. This changes the approach to also
keep a local synchronous state that is being updated on a change
callback.

DiffTrain build for [e2ba45b](facebook@e2ba45b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants