Skip to content

fix: make build table show empty instead of loading when none are recent #5666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix builds to show empty instead of loading
  • Loading branch information
presleyp committed Jan 11, 2023
commit 845367ee6d893e17d27ba38d65e4486226801dbd
2 changes: 1 addition & 1 deletion site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export const regenerateUserSSHKey = async (
export const getWorkspaceBuilds = async (
workspaceId: string,
since: Date,
): Promise<TypesGen.WorkspaceBuild[]> => {
): Promise<TypesGen.WorkspaceBuild[] | null> => {
const response = await axios.get<TypesGen.WorkspaceBuild[]>(
`/api/v2/workspaces/${workspaceId}/builds?since=${since.toISOString()}`,
)
Expand Down
3 changes: 2 additions & 1 deletion site/src/xServices/workspace/workspaceXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,11 @@ export const workspaceMachine = createMachine(
if (context.workspace) {
// For now, we only retrieve the last month of builds to minimize
// page bloat. We should add pagination in the future.
return await API.getWorkspaceBuilds(
const builds = await API.getWorkspaceBuilds(
context.workspace.id,
dayjs().add(-30, "day").toDate(),
)
return builds ?? []
} else {
throw Error("Cannot get builds without id")
}
Expand Down