Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3150773
D10476.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10476.diff
View Options
diff --git a/lib/hooks/disconnected-bar.js b/lib/hooks/disconnected-bar.js
--- a/lib/hooks/disconnected-bar.js
+++ b/lib/hooks/disconnected-bar.js
@@ -66,52 +66,4 @@
}, [connectionStatus, someRequestIsLate, setDisconnected]);
}
-function useShouldShowDisconnectedBar(): {
- +disconnected: boolean,
- +shouldShowDisconnectedBar: boolean,
-} {
- const connection = useSelector(connectionSelector(ashoatKeyserverID));
- invariant(connection, 'keyserver missing from keyserverStore');
- const disconnected = connection.showDisconnectedBar;
- const socketConnected = connection.status === 'connected';
-
- const shouldShowDisconnectedBar = disconnected || !socketConnected;
- return { disconnected, shouldShowDisconnectedBar };
-}
-
-type DisconnectedBarCause = 'connecting' | 'disconnected';
-
-function useDisconnectedBar(
- changeShowing: boolean => void,
-): DisconnectedBarCause {
- const { disconnected, shouldShowDisconnectedBar } =
- useShouldShowDisconnectedBar();
-
- const prevShowDisconnectedBar = React.useRef<?boolean>();
- React.useEffect(() => {
- const wasShowing = prevShowDisconnectedBar.current;
- if (shouldShowDisconnectedBar && wasShowing === false) {
- changeShowing(true);
- } else if (!shouldShowDisconnectedBar && wasShowing) {
- changeShowing(false);
- }
- prevShowDisconnectedBar.current = shouldShowDisconnectedBar;
- }, [shouldShowDisconnectedBar, changeShowing]);
-
- const [barCause, setBarCause] =
- React.useState<DisconnectedBarCause>('connecting');
- React.useEffect(() => {
- if (shouldShowDisconnectedBar && disconnected) {
- setBarCause('disconnected');
- } else if (shouldShowDisconnectedBar) {
- setBarCause('connecting');
- }
- }, [shouldShowDisconnectedBar, disconnected]);
- return barCause;
-}
-
-export {
- useDisconnectedBarVisibilityHandler,
- useShouldShowDisconnectedBar,
- useDisconnectedBar,
-};
+export { useDisconnectedBarVisibilityHandler };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 12:32 AM (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2427008
Default Alt Text
D10476.diff (1 KB)
Attached To
Mode
D10476: [lib] Rip `useShouldShowDisconnectedBar` and `useDisconnectedBar` out of `hooks/disconnected-bar`
Attached
Detach File
Event Timeline
Log In to Comment