diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-10-26 14:48:15 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-10-26 14:48:15 -0500 |
commit | 1ab8285ad37020094fa27aca95837a2e6650dcd4 (patch) | |
tree | 4a71387263b8914eac1910e415bfc80ebe9fcce7 /src/view/screens/Notifications.tsx | |
parent | 1983512fef37c5f27a048728815ae194bb24820b (diff) | |
download | voidsky-1ab8285ad37020094fa27aca95837a2e6650dcd4.tar.zst |
Fix some useEffect() cleanup issues
Diffstat (limited to 'src/view/screens/Notifications.tsx')
-rw-r--r-- | src/view/screens/Notifications.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/view/screens/Notifications.tsx b/src/view/screens/Notifications.tsx index 60627385f..fac39acd2 100644 --- a/src/view/screens/Notifications.tsx +++ b/src/view/screens/Notifications.tsx @@ -13,6 +13,7 @@ export const Notifications = ({visible}: ScreenParams) => { const store = useStores() useEffect(() => { + let aborted = false if (!visible) { return } @@ -24,7 +25,13 @@ export const Notifications = ({visible}: ScreenParams) => { console.log('Fetching notifications feed') const newNotesView = new NotificationsViewModel(store, {}) setNotesView(newNotesView) - newNotesView.setup().then(() => setHasSetup(true)) + newNotesView.setup().then(() => { + if (aborted) return + setHasSetup(true) + }) + } + return () => { + aborted = true } }, [visible, store]) |