Page MenuHomePhabricator

D10476.id35207.diff
No OneTemporary

D10476.id35207.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
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)

Event Timeline