Skip to content

Commit

Permalink
fix: render app on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed May 7, 2024
1 parent b055511 commit f1f72d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
21 changes: 9 additions & 12 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const App = () => {
const toastMsg = useAppSelector(getToastMsg);
const [showScan, setShowScan] = useState(false);
const [showToast, setShowToast] = useState(false);
const [lockIsRendered, setLockIsRendered] = useState(false);

const isPreviewMode = useMemo(
() => new URLSearchParams(window.location.search).has("browserPreview"),
Expand Down Expand Up @@ -102,15 +101,7 @@ const App = () => {
}, []);

const renderApp = () => {
if (!lockIsRendered) {
// We need to include the LockModal in the loading page to track when is rendered
return (
<>
<LockPage didEnter={() => setLockIsRendered(true)} />
{LoadingPage()}
</>
);
} else if (showScan) {
if (showScan) {
return <FullPageScanner setShowScan={setShowScan} />;
} else {
return (
Expand All @@ -126,8 +117,14 @@ const App = () => {
<IonApp>
<AppWrapper>
<StrictMode>
{lockIsRendered && !authentication.loggedIn ? <LockPage /> : null}
{stateCache.initialized ? renderApp() : LoadingPage()}
{stateCache.initialized ? (
<>
{renderApp()}
{!authentication.loggedIn ? <LockPage /> : null}
</>
) : (
LoadingPage()
)}
<SetUserName
isOpen={showSetUserName}
setIsOpen={setShowSetUserName}
Expand Down
7 changes: 1 addition & 6 deletions src/ui/pages/LockPage/LockPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import {
import { KeyStoreKeys, SecureStorage } from "../../../core/storage";
import { RoutePath } from "../../../routes";
import { PublicRoutes } from "../../../routes/paths";
import { LockPageProps } from "./LockPage.types";
import { PasscodeModule } from "../../components/PasscodeModule";
import { PageFooter } from "../../components/PageFooter";
import { Alert } from "../../components/Alert";
import "./LockPage.scss";

const LockPage = ({ didEnter }: LockPageProps) => {
const LockPage = () => {
const pageId = "lock-page";
const ionRouter = useAppIonRouter();
const dispatch = useAppDispatch();
Expand All @@ -39,10 +38,6 @@ const LockPage = ({ didEnter }: LockPageProps) => {
: i18n.t("lockpage.alert.button.restart");
const cancelButtonText = i18n.t("lockpage.alert.button.cancel");

useEffect(() => {
didEnter && didEnter();
}, []);

const handleClearState = () => {
setAlertIsOpen(false);
setPasscodeIncorrect(false);
Expand Down
5 changes: 0 additions & 5 deletions src/ui/pages/LockPage/LockPage.types.ts

This file was deleted.

0 comments on commit f1f72d4

Please sign in to comment.