Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

fix(mobile): clear all queries on server change (#1369)

Corentin Thomassetba15488c88df
diff --git a/apps/mobile/src/modules/config/screens/server-selection.screen.tsx b/apps/mobile/src/modules/config/screens/server-selection.screen.tsx
index 007ea52a..7f6ad54a 100644
--- a/apps/mobile/src/modules/config/screens/server-selection.screen.tsx
+++ b/apps/mobile/src/modules/config/screens/server-selection.screen.tsx
@@ -111,6 +111,10 @@ export function ServerSelectionScreen() {
await configLocalStorage.setApiServerConfig({
apiServerConfig: { baseUrl: url, customHeaders },
});
+
+ queryClient.removeQueries({
+ predicate: ({ queryKey }) => queryKey !== configQueryOptions.queryKey,
+ });
await queryClient.invalidateQueries({ queryKey: configQueryOptions.queryKey });
router.replace('/auth/login');