Skip to content

Commit

Permalink
web: fix app stuck on splash screen after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Nov 19, 2024
1 parent dafc2de commit d3e2fcc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 0 additions & 3 deletions apps/web/src/app-effects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,6 @@ export default function AppEffects({ setShow }: AppEffectsProps) {

useEffect(() => {
introduceFeatures();
return () => {
EV.unsubscribeAll();
};
}, []);

useEffect(() => {
Expand Down
14 changes: 10 additions & 4 deletions apps/web/src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { loadDatabase } from "./hooks/use-database";
import AppLock from "./views/app-lock";
import { Text } from "@theme-ui/components";
import { EV, EVENTS } from "@notesnook/core";
import { useState } from "react";
import { useEffect, useState } from "react";

export async function startApp() {
const rootElement = document.getElementById("root");
Expand Down Expand Up @@ -98,10 +98,16 @@ function RouteWrapper(props: {
}) {
const [isMigrating, setIsMigrating] = useState(false);
const { Component, path, routeProps } = props;
const result = usePromise(async () => {
EV.subscribe(EVENTS.migrationStarted, () => setIsMigrating(true), true);
EV.subscribe(EVENTS.migrationFinished, () => setIsMigrating(false), true);

useEffect(() => {
EV.subscribe(EVENTS.migrationStarted, () => setIsMigrating(true));
EV.subscribe(EVENTS.migrationFinished, () => setIsMigrating(false));
return () => {
EV.unsubscribeAll();
};
}, []);

const result = usePromise(async () => {
performance.mark("load:database");
await loadDatabase(
path !== "/sessionexpired" || Config.get("sessionExpired", false)
Expand Down

0 comments on commit d3e2fcc

Please sign in to comment.