Space panel should watch spaces for space name changes (#7432)

This commit is contained in:
Michael Telatynski 2021-12-21 15:35:54 +00:00 committed by GitHub
parent 70dc03552c
commit 38634f86d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View file

@ -65,6 +65,8 @@ export const useEventEmitterState = <T>(
const handler = useCallback((...args: any[]) => {
setValue(fn(...args));
}, [fn]);
// re-run when the emitter changes
useEffect(handler, [emitter]); // eslint-disable-line react-hooks/exhaustive-deps
useEventEmitter(emitter, eventName, handler);
return value;
};