Page MenuHomePhabricator

D10476.id35062.diff
No OneTemporary

D10476.id35062.diff

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

Mime Type
text/plain
Expires
Wed, Nov 6, 2:51 AM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2427008
Default Alt Text
D10476.id35062.diff (1 KB)

Event Timeline