Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
RichParameter,
} from "./provisionerGenerated";
import { prometheusPort, pprofPort } from "./constants";
import { port, TEST_TIMEOUT } from "./playwright.config";
import { port } from "./playwright.config";
import * as ssh from "ssh2";
import { Duplex } from "stream";
import { WorkspaceBuildParameter } from "api/typesGenerated";
Expand Down Expand Up @@ -197,7 +197,6 @@ export const stopWorkspace = async (page: Page, workspaceName: string) => {
"span[data-testid='build-status'] >> text=Stopped",
{
state: "visible",
timeout: TEST_TIMEOUT * 2,
},
);
};
Expand Down
4 changes: 1 addition & 3 deletions site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const coderMain = path.join(__dirname, "../../enterprise/cmd/coder");

export const STORAGE_STATE = path.join(__dirname, ".auth.json");

export const TEST_TIMEOUT = 60_000;

const localURL = (port: number, path: string): string => {
return `http://localhost:${port}${path}`;
};
Expand All @@ -31,7 +29,7 @@ export default defineConfig({
use: {
storageState: STORAGE_STATE,
},
timeout: TEST_TIMEOUT,
timeout: 60_000,
},
],
reporter: [["./reporter.ts"]],
Expand Down
16 changes: 12 additions & 4 deletions site/src/api/queries/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,18 @@ const updateWorkspaceBuild = async (
build.workspace_name,
);
const previousData = queryClient.getQueryData(workspaceKey) as Workspace;
queryClient.setQueryData(workspaceKey, {
...previousData,
latest_build: build,
});

// Check if the build returned is newer than the previous build that could be
// updated from web socket
const previousUpdate = new Date(previousData.latest_build.updated_at);
const newestUpdate = new Date(build.updated_at);
if (newestUpdate > previousUpdate) {
queryClient.setQueryData(workspaceKey, {
...previousData,
latest_build: build,
});
}

await queryClient.invalidateQueries({
queryKey: workspaceBuildsKey(build.workspace_id),
});
Expand Down