feat: Show collab cursor names upon loading document. (#2732)

Second attempt, adds a class to the editor for a couple of seconds when the awareness is loaded to force cursors to display
This commit is contained in:
Tom Moor
2021-11-04 17:24:23 -07:00
committed by GitHub
parent 1a6921f6c7
commit eb9ff990ac
3 changed files with 43 additions and 1 deletions

21
app/hooks/useIsMounted.js Normal file
View File

@@ -0,0 +1,21 @@
// @flow
import * as React from "react";
/**
* Hook to check if component is still mounted
*
* @returns {boolean} true if the component is mounted, false otherwise
*/
export default function useIsMounted() {
const isMounted = React.useRef(false);
React.useEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return React.useCallback(() => isMounted.current, []);
}