Skip to content

Commit

Permalink
fix(ui): clear cache on integration save (#2759)
Browse files Browse the repository at this point in the history
## Describe your changes

Fixes
https://linear.app/nango/issue/NAN-1784/refresh-cache-on-integration-save

- Refresh cache when we save integration credentials
  • Loading branch information
bodinsamuel authored Sep 24, 2024
1 parent 89e68f0 commit 73f1d3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useState } from 'react';
import { useStore } from '../../../../../store';
import { apiPatchIntegration } from '../../../../../hooks/useIntegration';
import { useToast } from '../../../../../hooks/useToast';
import { mutate } from 'swr';

export const SettingsApp: React.FC<{ data: GetIntegration['Success']['data']; environment: EnvironmentAndAccount['environment'] }> = ({
data: { integration },
Expand All @@ -32,6 +33,7 @@ export const SettingsApp: React.FC<{ data: GetIntegration['Success']['data']; en
toast({ title: updated.json.error.message || 'Failed to update, an error occurred', variant: 'error' });
} else {
toast({ title: 'Successfully updated integration', variant: 'success' });
void mutate((key) => typeof key === 'string' && key.startsWith(`/api/v1/integrations`));
}

setLoading(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useStore } from '../../../../../store';
import SecretTextarea from '../../../../../components/ui/input/SecretTextArea';
import { apiPatchIntegration } from '../../../../../hooks/useIntegration';
import { useToast } from '../../../../../hooks/useToast';
import { mutate } from 'swr';

export const SettingsCustom: React.FC<{ data: GetIntegration['Success']['data']; environment: EnvironmentAndAccount['environment'] }> = ({
data: { integration },
Expand All @@ -36,6 +37,7 @@ export const SettingsCustom: React.FC<{ data: GetIntegration['Success']['data'];
toast({ title: updated.json.error.message || 'Failed to update, an error occurred', variant: 'error' });
} else {
toast({ title: 'Successfully updated integration', variant: 'success' });
void mutate((key) => typeof key === 'string' && key.startsWith(`/api/v1/integrations`));
}

setLoading(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useStore } from '../../../../../store';
import TagsInput from '../../../../../components/ui/input/TagsInput';
import { apiPatchIntegration } from '../../../../../hooks/useIntegration';
import { useToast } from '../../../../../hooks/useToast';
import { mutate } from 'swr';

export const SettingsOAuth: React.FC<{ data: GetIntegration['Success']['data']; environment: EnvironmentAndAccount['environment'] }> = ({
data: { integration, template },
Expand All @@ -33,6 +34,7 @@ export const SettingsOAuth: React.FC<{ data: GetIntegration['Success']['data'];
if ('error' in updated.json) {
toast({ title: updated.json.error.message || 'Failed to update, an error occurred', variant: 'error' });
} else {
void mutate((key) => typeof key === 'string' && key.startsWith(`/api/v1/integrations`));
toast({ title: 'Successfully updated integration', variant: 'success' });
}

Expand Down

0 comments on commit 73f1d3c

Please sign in to comment.