Skip to content

Commit

Permalink
Fix error screen
Browse files Browse the repository at this point in the history
- Clear loaders after error.
  • Loading branch information
dworthen committed Feb 24, 2024
1 parent 00dfd32 commit d5401fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .changeset/tender-countries-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'gov4git-desktop-app': patch
---

Fix error screen

- Clear loaders after error.
9 changes: 1 addition & 8 deletions src/renderer/src/pages/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ export const Layout = function Layout() {
const navigate = useNavigate()
const settingsError = useGlobalSettingsErrors()
const userLoaded = useDataStore((s) => s.userInfo.userLoaded)
const communitiesLoaded = useDataStore(
(s) => s.communityInfo.communitiesLoaded,
)

const loading = useMemo(() => {
return !userLoaded || !communitiesLoaded
}, [userLoaded, communitiesLoaded])

useEffect(() => {
if (exceptionMessage !== '') {
Expand Down Expand Up @@ -60,7 +53,7 @@ export const Layout = function Layout() {
<main className={classes.main} ref={mainRef}>
<ErrorPanel />
<ExceptionPanel />
<Loader isLoading={loading}>
<Loader isLoading={!userLoaded}>
<Outlet />
</Loader>
</main>
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/src/store/errorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export const createErrorStore: StateCreator<
s.exception = `${msg} ${ex}`
})
}
set((s) => {
s.motionInfo.loading = false
s.communityInfo.loading = false
s.userInfo.loading = false
s.userInfo.userLoaded = true
})
}
},
})

0 comments on commit d5401fd

Please sign in to comment.