Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

fix(deployment): open Sync with Deployed to the default server in its own window (#1482)

l0ng-aia0595f5c1288
diff --git a/src/features/deployment/actions.test.tsx b/src/features/deployment/actions.test.tsx
index 63ab8cdb8..6ad60a217 100644
--- a/src/features/deployment/actions.test.tsx
+++ b/src/features/deployment/actions.test.tsx
@@ -109,6 +109,32 @@ describe("deployment eligibility", () => {
expect(useDeployment.getState().sync).toBeNull();
expect(mocks.compare).not.toHaveBeenCalled();
});
+ it("opens default-server synchronization in a native window on desktop too", async () => {
+ mocks.desktop = true;
+ // The default server needs no choice, and on desktop nothing opens in the page.
+ mocks.actions
+ .find((action) => action.id === "deployment.syncWithDefault")!
+ .run({ arg: ["/project/a", "/project/b"] });
+ await vi.waitFor(() => expect(mocks.openWindow).toHaveBeenCalledWith("one", ["/project/a", "/project/b"]));
+ expect(mocks.choose).not.toHaveBeenCalled();
+ expect(useDeployment.getState().sync).toBeNull();
+ expect(mocks.compare).not.toHaveBeenCalled();
+ });
+ it.each(["deployment.syncWith", "deployment.syncWithDefault"])(
+ "reports a comparison window that cannot open (%s)",
+ async (action) => {
+ mocks.desktop = true;
+ mocks.choose.mockResolvedValue("one");
+ mocks.openWindow.mockRejectedValueOnce(new Error("window failed"));
+ await run(action);
+ await vi.waitFor(() =>
+ expect(mocks.notify).toHaveBeenCalledWith(
+ expect.objectContaining({ title: expect.stringContaining("Cannot open comparison") }),
+ ),
+ );
+ expect(useDeployment.getState().sync).toBeNull();
+ },
+ );
it("saves edits made in the local diff before synchronization and stops if saving fails", async () => {
await run("deployment.syncWith");
mocks.choose.mockResolvedValue("one");
diff --git a/src/features/deployment/actions.tsx b/src/features/deployment/actions.tsx
index 2c558afbb..f3bd0822e 100644
--- a/src/features/deployment/actions.tsx
+++ b/src/features/deployment/actions.tsx
@@ -225,6 +225,16 @@ async function deleteRemote(paths: string[]) {
}
/** Compares every covered selection with `server`. */
+/** Sync with Deployed to: its own window on desktop (the browser build keeps the in-page dialog). */
+async function openComparison(server: DeploymentServerValid, paths: string[]) {
+ if (!isTauri()) return openSync(server, paths);
+ try {
+ await showDeploymentComparison(server.id, paths);
+ } catch (error) {
+ showFailure("Cannot open comparison for {server}", server, error);
+ }
+}
+
export async function openSync(server: DeploymentServerValid, paths: string[]) {
const coverage = (await serverCoverage(paths))?.find((c) => c.server === server.id);
if (!coverage) return;
@@ -453,15 +463,7 @@ export function registerDeploymentActions(): () => void {
const target = paths[0] ?? projectRoot();
if (!target) return;
const targets = paths.length ? paths : [target];
- void pickServer("Sync with Deployed to", targets).then(async (server) => {
- if (!server) return;
- if (!isTauri()) return openSync(server, targets);
- try {
- await showDeploymentComparison(server.id, targets);
- } catch (error) {
- showFailure("Cannot open comparison for {server}", server, error);
- }
- });
+ void pickServer("Sync with Deployed to", targets).then((server) => server && openComparison(server, targets));
},
},
{
@@ -473,7 +475,7 @@ export function registerDeploymentActions(): () => void {
keywords: ["deploy", "sftp", "compare", "synchronize", "remote", "diff"],
run: withTargets(async (paths) => {
const server = await defaultServer("Sync with Deployed to", paths);
- if (server) await openSync(server, paths);
+ if (server) await openComparison(server, paths);
}),
},
{