Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3353215
D10476.id35207.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.id35207.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
Sun, Nov 24, 8:53 AM (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574247
Default Alt Text
D10476.id35207.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