Added a clarifying comment to SearchInput
Brian Vaughn committed
Feb 6, 2019 at 17:09 UTC
c61e0f0d54c0cc1cfe897cfc4e2cd956bda2509d
1 file changed
+4
src/devtools/views/SearchInput.js
+4
@@ -9,6 +9,10 @@ import styles from './SearchInput.css';
9
type Props = {||};
10
11
export default function SearchInput(props: Props) {
12
+ // We use the wrapper searchContext object rather than its individual parts–
13
+ // (specifically for the useCallback input arrays below)–
14
+ // because a change in any one value (e.g. ids array) impacts other values (e.g. currentIndex).
15
+ // It's easier to avoid stale scope issues if we depend on the entire search state.
16
const searchContext = useContext(SearchContext);
17
18
const inputRef = useRef();