Skip to content

Commit

Permalink
Fix Unlock Flash (#877)
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Baroni <7061887+christianbaroni@users.noreply.github.com>
Co-authored-by: Bruno Barbieri <1247834+brunobar79@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 23, 2023
1 parent 4029831 commit 87f19ac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/entries/popup/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,23 @@ export const ProtectedRoute = ({
children: React.ReactNode;
allowedStates: UserStatusResult[] | true;
}): JSX.Element => {
const { status } = useAuth();
const { status, updateStatus } = useAuth();
const isFullScreen = useIsFullScreen();
const { pendingRequests } = usePendingRequestStore();

const [isStatusInitialized, setStatusInitialized] = React.useState(false);
React.useEffect(() => {
const initializeStatus = async () => {
await updateStatus();
setStatusInitialized(true);
};
initializeStatus();
}, [updateStatus]);

if (!isStatusInitialized) {
return <></>;
}

// we don't want to move from ready screen when we reach it
if (isReadyScreen()) {
return children as JSX.Element;
Expand Down

0 comments on commit 87f19ac

Please sign in to comment.