diff --git a/package-lock.json b/package-lock.json index e73eebb..9381c5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "version": "0.0.17", + "version": "0.0.18", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 137d8ef..73f11d4 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "coding-assistant", "codiga" ], - "version": "0.0.17", + "version": "0.0.18", "homepage": "https://www.codiga.io/", "bugs": { "url": "https://github.com/codiga/code-snippets-manager/issues" diff --git a/release/app/package-lock.json b/release/app/package-lock.json index c821f42..5c47d8b 100644 --- a/release/app/package-lock.json +++ b/release/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "codiga", - "version": "0.0.17", + "version": "0.0.18", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/release/app/package.json b/release/app/package.json index 2291536..fd219e3 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "codiga", - "version": "0.0.17", + "version": "0.0.18", "description": "Codiga Code Snippets Manager", "license": "MIT", "author": { diff --git a/src/renderer/components/Layout/SideMenu.tsx b/src/renderer/components/Layout/SideMenu.tsx index 686c010..49d0015 100644 --- a/src/renderer/components/Layout/SideMenu.tsx +++ b/src/renderer/components/Layout/SideMenu.tsx @@ -105,6 +105,8 @@ export default function SideMenu({ openLoginModal }: SideMenuProps) { localStorage.removeItem(TOKEN); setUser({}); navigate('/'); + await apolloClient.clearStore(); + await apolloClient.cache.reset(); await apolloClient.resetStore(); } catch (err) { // eslint-disable-next-line no-console diff --git a/src/renderer/components/Login/Login.tsx b/src/renderer/components/Login/Login.tsx index fb165c5..55373e1 100644 --- a/src/renderer/components/Login/Login.tsx +++ b/src/renderer/components/Login/Login.tsx @@ -53,9 +53,12 @@ export default function Login({ isOpen, closeModal }: LoginProps) { // set the token in localStorarge, which the apollo client will grab localStorage.setItem(TOKEN, formData.token); // check if a user is returned now - const { data } = await validateToken(); + const { data, error } = await validateToken({ + fetchPolicy: 'network-only', + nextFetchPolicy: 'network-only', + }); // valid token, close/reset modal, otherwise remove token and show an error to the user - if (data?.user) { + if (data?.user && !error) { setUser(data.user); closeAndReset(); } else { diff --git a/src/renderer/components/UserContext/UserContext.tsx b/src/renderer/components/UserContext/UserContext.tsx index 7a74b99..e9b12ff 100644 --- a/src/renderer/components/UserContext/UserContext.tsx +++ b/src/renderer/components/UserContext/UserContext.tsx @@ -15,7 +15,8 @@ export const UserProvider = ({ children }: { children: ReactNode }) => { useQuery<{ user: Partial }>(CHECK_USER, { pollInterval: POLL_USER_FOR_LOGOUT_MSEC, - fetchPolicy: 'no-cache', + fetchPolicy: 'network-only', + nextFetchPolicy: 'network-only', onCompleted: (respData) => { if (respData?.user) { setUser(respData?.user);