Skip to content

Commit 8131de1

Browse files
authored
prevent unused exec getCurrentValue after re-render (#22442)
1 parent 580e2f5 commit 8131de1

File tree

1 file changed

+2
-2
lines changed
  • packages/react-devtools-shared/src/devtools/views

1 file changed

+2
-2
lines changed

packages/react-devtools-shared/src/devtools/views/hooks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ export function useSubscription<Value>({
264264
getCurrentValue: () => Value,
265265
subscribe: (callback: Function) => () => void,
266266
|}): Value {
267-
const [state, setState] = useState({
267+
const [state, setState] = useState(() => ({
268268
getCurrentValue,
269269
subscribe,
270270
value: getCurrentValue(),
271-
});
271+
}));
272272

273273
if (
274274
state.getCurrentValue !== getCurrentValue ||

0 commit comments

Comments
 (0)