Skip to content

Commit

Permalink
prevent unused exec getCurrentValue after re-render (facebook#22442)
Browse files Browse the repository at this point in the history
  • Loading branch information
behnammodi authored Sep 27, 2021
1 parent 580e2f5 commit 8131de1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-devtools-shared/src/devtools/views/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ export function useSubscription<Value>({
getCurrentValue: () => Value,
subscribe: (callback: Function) => () => void,
|}): Value {
const [state, setState] = useState({
const [state, setState] = useState(() => ({
getCurrentValue,
subscribe,
value: getCurrentValue(),
});
}));

if (
state.getCurrentValue !== getCurrentValue ||
Expand Down

0 comments on commit 8131de1

Please sign in to comment.