From c61e0f0d54c0cc1cfe897cfc4e2cd956bda2509d Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 6 Feb 2019 17:09:46 +0000 Subject: [PATCH] Added a clarifying comment to SearchInput --- src/devtools/views/SearchInput.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/devtools/views/SearchInput.js b/src/devtools/views/SearchInput.js index 518f071fb5..330f257aba 100644 --- a/src/devtools/views/SearchInput.js +++ b/src/devtools/views/SearchInput.js @@ -9,6 +9,10 @@ import styles from './SearchInput.css'; type Props = {||}; export default function SearchInput(props: Props) { + // We use the wrapper searchContext object rather than its individual parts– + // (specifically for the useCallback input arrays below)– + // because a change in any one value (e.g. ids array) impacts other values (e.g. currentIndex). + // It's easier to avoid stale scope issues if we depend on the entire search state. const searchContext = useContext(SearchContext); const inputRef = useRef();