Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(discord): preserve dirty integration form state

Tin12af824df68f
diff --git a/apps/web/src/components/project/discord-integration-settings.tsx b/apps/web/src/components/project/discord-integration-settings.tsx
index 7dfe8d0a7..b777956db 100644
--- a/apps/web/src/components/project/discord-integration-settings.tsx
+++ b/apps/web/src/components/project/discord-integration-settings.tsx
@@ -136,10 +136,17 @@ export function DiscordIntegrationSettings({
},
});
const { reset } = form;
+ const lastResetKeyRef = React.useRef<string | null>(null);
+ const resetKey = `${projectId}:${integration?.id ?? "none"}`;
React.useEffect(() => {
+ if (form.formState.isDirty && lastResetKeyRef.current === resetKey) {
+ return;
+ }
+
reset(normalizedValues);
- }, [normalizedValues, reset]);
+ lastResetKeyRef.current = resetKey;
+ }, [form.formState.isDirty, normalizedValues, reset, resetKey]);
const isConnected = Boolean(integration?.webhookConfigured);
const isBusy = isCreating || isUpdating || isDeleting;