mirror of
https://github.com/docmost/docmost.git
synced 2026-08-24 01:12:22 +10:00
fix(integration): show disconnect loader only on the affected row
This commit is contained in:
@@ -8,7 +8,7 @@ type ConnectionRowProps = {
|
|||||||
connection?: UserConnection;
|
connection?: UserConnection;
|
||||||
onConnect: (type: string) => void;
|
onConnect: (type: string) => void;
|
||||||
onDisconnect: (integrationId: string) => void;
|
onDisconnect: (integrationId: string) => void;
|
||||||
isDisconnecting?: boolean;
|
disconnectingId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ConnectionRow({
|
export default function ConnectionRow({
|
||||||
@@ -16,7 +16,7 @@ export default function ConnectionRow({
|
|||||||
connection,
|
connection,
|
||||||
onConnect,
|
onConnect,
|
||||||
onDisconnect,
|
onDisconnect,
|
||||||
isDisconnecting,
|
disconnectingId,
|
||||||
}: ConnectionRowProps) {
|
}: ConnectionRowProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isWorkspaceScoped = definition.oauth?.connectionScope === 'workspace';
|
const isWorkspaceScoped = definition.oauth?.connectionScope === 'workspace';
|
||||||
@@ -85,7 +85,7 @@ export default function ConnectionRow({
|
|||||||
variant="subtle"
|
variant="subtle"
|
||||||
color="red"
|
color="red"
|
||||||
onClick={() => onDisconnect(connection.integrationId)}
|
onClick={() => onDisconnect(connection.integrationId)}
|
||||||
loading={isDisconnecting}
|
loading={disconnectingId === connection.integrationId}
|
||||||
>
|
>
|
||||||
{t("Disconnect")}
|
{t("Disconnect")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ export default function Connections() {
|
|||||||
disconnectMutation.mutate({ integrationId });
|
disconnectMutation.mutate({ integrationId });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only the row being disconnected shows a loader; isPending alone is shared by every row.
|
||||||
|
const disconnectingId = disconnectMutation.isPending
|
||||||
|
? disconnectMutation.variables?.integrationId
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const error = new URLSearchParams(window.location.search).get("error");
|
const error = new URLSearchParams(window.location.search).get("error");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -95,7 +100,7 @@ export default function Connections() {
|
|||||||
connection={connection}
|
connection={connection}
|
||||||
onConnect={handleConnect}
|
onConnect={handleConnect}
|
||||||
onDisconnect={handleDisconnect}
|
onDisconnect={handleDisconnect}
|
||||||
isDisconnecting={disconnectMutation.isPending}
|
disconnectingId={disconnectingId}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user