prevent unused exec getCurrentValue after re-render (#22442)

This commit is contained in:
Behnam Mohammadi authored and GitHub committed 2021-09-27 17:20:32 -04:00
1 parent 580e2f56d5
commit 8131de13e2
1 file changed
+2 -2
+2 -2
View File
@@ -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 ||