-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): improve cache for session, integrations (#1904)
## Describe your changes Fix NAN-639 - Completely empty SWR cache request when we logout This is an edge case as most user don't have multiple account, but that can avoid some surprises. - Create hook for integration list and expose correct type - Correctly mutate cache when we create, update, delete integrations ## Demo https://github.com/NangoHQ/nango/assets/1637651/41771184-b458-43b0-9d25-a07a2736dab8
- Loading branch information
1 parent
e065491
commit 452a806
Showing
7 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export type { GetMeta } from './controllers/environment.controller.js'; | ||
export type { GetUser } from './controllers/user.controller.js'; | ||
export type { ListIntegration, Integration } from './controllers/config.controller.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import useSWR from 'swr'; | ||
import type { ListIntegration } from '@nangohq/server'; | ||
import { swrFetcher } from '../utils/api'; | ||
|
||
export function useListIntegration(env: string) { | ||
const { data, error, mutate } = useSWR<ListIntegration>(`/api/v1/integration?env=${env}`, swrFetcher); | ||
|
||
const loading = !data && !error; | ||
|
||
return { | ||
loading, | ||
error, | ||
list: data, | ||
mutate | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters