fix(linear): sync status when reconnecting saved installations

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-19 01:24:27 +08:00
1 parent 4f85b78c67
commit a3686d5eba
2 files changed
+21 -1

No files matched your search

@@ -348,6 +348,23 @@ describe("Linear channel UI", () => {
expect(screen.queryByText("Authorization stopped.")).not.toBeInTheDocument();
});
it("updates the running status when an existing installation connects without OAuth", async () => {
const feature = savedFeature();
mockFeature(feature);
requestMutationMock.mockResolvedValueOnce({
session_id: "", status: "succeeded",
nanobot_features: {
features: [{ ...feature, enabled: true, running: true, runtime_status: "running" }],
enabled_count: 1,
},
});
renderSettingsView({ initialSection: "channels" });
fireEvent.click(await screen.findByRole("button", { name: "View Linear settings" }));
fireEvent.click(await screen.findByRole("button", { name: "Connect Linear" }));
expect(await within(screen.getByRole("dialog")).findByText("Connected", { exact: true })).toBeVisible();
expect(screen.getByRole("button", { name: "Connect another workspace" })).toBeEnabled();
});
it("does not mark saved credentials or a failed runtime as connected", async () => {
mockFeature({ ...savedFeature(), enabled: true, configured: true, runtime_status: "failed",
runtime_error: "Linear channel failed to start" });
@@ -184,12 +184,15 @@ export function ChannelQrConnectFlow({
...(force ? { force: true } : {}),
});
setConnect(payload);
if (payload.nanobot_features) {
onFeaturesUpdate(payload.nanobot_features);
}
} catch (err) {
setError((err as Error).message);
} finally {
setBusy(false);
}
}, [channelName, client, startParams]);
}, [channelName, client, startParams, onFeaturesUpdate]);
useEffect(() => {
const requested = Boolean(connectRequestId && connectRequestId !== handledRequestId.current);