Skip to content

Commit 65878b0

Browse files
authored
fix: remove "something went wrong" text for watching a workspace (#6541)
This text wasn't useful to a customer anyways, because we don't get an error from EventSource. This can happen if you close your laptop and open it again, so it's better if we don't display it.
1 parent 50432b8 commit 65878b0

File tree

4 files changed

+5
-47
lines changed

4 files changed

+5
-47
lines changed

site/src/components/Workspace/Workspace.stories.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ GetBuildsError.args = {
113113
},
114114
}
115115

116-
export const GetResourcesError = Template.bind({})
117-
GetResourcesError.args = {
118-
...Running.args,
119-
workspaceErrors: {
120-
[WorkspaceErrors.GET_RESOURCES_ERROR]: Mocks.makeMockApiError({
121-
message: "There is a problem fetching workspace resources.",
122-
}),
123-
},
124-
}
125-
126116
export const CancellationError = Template.bind({})
127117
CancellationError.args = {
128118
...Failed.args,

site/src/components/Workspace/Workspace.tsx

-22
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { WorkspaceDeletedBanner } from "../WorkspaceDeletedBanner/WorkspaceDelet
1717
import { WorkspaceScheduleButton } from "../WorkspaceScheduleButton/WorkspaceScheduleButton"
1818
import { WorkspaceStats } from "../WorkspaceStats/WorkspaceStats"
1919
import { AlertBanner } from "../AlertBanner/AlertBanner"
20-
import { useTranslation } from "react-i18next"
2120
import {
2221
ActiveTransition,
2322
WorkspaceBuildProgress,
@@ -26,11 +25,9 @@ import { AgentRow } from "components/Resources/AgentRow"
2625
import { Avatar } from "components/Avatar/Avatar"
2726

2827
export enum WorkspaceErrors {
29-
GET_RESOURCES_ERROR = "getResourcesError",
3028
GET_BUILDS_ERROR = "getBuildsError",
3129
BUILD_ERROR = "buildError",
3230
CANCELLATION_ERROR = "cancellationError",
33-
WORKSPACE_REFRESH_WARNING = "refreshWorkspaceWarning",
3431
}
3532

3633
export interface WorkspaceProps {
@@ -88,7 +85,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
8885
templateParameters,
8986
quota_budget,
9087
}) => {
91-
const { t } = useTranslation("workspacePage")
9288
const styles = useStyles()
9389
const navigate = useNavigate()
9490
const serverVersion = buildInfo?.version || ""
@@ -111,16 +107,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
111107
/>
112108
)
113109

114-
const workspaceRefreshWarning = Boolean(
115-
workspaceErrors[WorkspaceErrors.WORKSPACE_REFRESH_WARNING],
116-
) && (
117-
<AlertBanner
118-
severity="warning"
119-
text={t("warningsAndErrors.workspaceRefreshWarning")}
120-
dismissible
121-
/>
122-
)
123-
124110
let transitionStats: TypesGen.TransitionStats | undefined = undefined
125111
if (template !== undefined) {
126112
transitionStats = ActiveTransition(template, workspace)
@@ -187,7 +173,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
187173
>
188174
{buildError}
189175
{cancellationError}
190-
{workspaceRefreshWarning}
191176

192177
<WorkspaceDeletedBanner
193178
workspace={workspace}
@@ -207,13 +192,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
207192
/>
208193
)}
209194

210-
{Boolean(workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR]) && (
211-
<AlertBanner
212-
severity="error"
213-
error={workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR]}
214-
/>
215-
)}
216-
217195
{typeof resources !== "undefined" && resources.length > 0 && (
218196
<Resources
219197
resources={resources}

site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export const WorkspaceReadyPage = ({
4646
workspace,
4747
template,
4848
templateParameters,
49-
refreshWorkspaceWarning,
5049
builds,
5150
getBuildsError,
5251
buildError,
@@ -119,7 +118,6 @@ export const WorkspaceReadyPage = ({
119118
hideSSHButton={featureVisibility["browser_only"]}
120119
hideVSCodeDesktopButton={featureVisibility["browser_only"]}
121120
workspaceErrors={{
122-
[WorkspaceErrors.GET_RESOURCES_ERROR]: refreshWorkspaceWarning,
123121
[WorkspaceErrors.GET_BUILDS_ERROR]: getBuildsError,
124122
[WorkspaceErrors.BUILD_ERROR]: buildError,
125123
[WorkspaceErrors.CANCELLATION_ERROR]: cancellationError,

site/src/xServices/workspace/workspaceXService.ts

+5-13
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export interface WorkspaceContext {
5858
templateParameters?: TypesGen.TemplateVersionParameter[]
5959
build?: TypesGen.WorkspaceBuild
6060
getWorkspaceError?: Error | unknown
61-
// these are labeled as warnings because they don't make the page unusable
62-
refreshWorkspaceWarning?: Error | unknown
6361
getTemplateWarning: Error | unknown
6462
getTemplateParametersWarning: Error | unknown
6563
// Builds
@@ -278,18 +276,15 @@ export const workspaceMachine = createMachine(
278276
},
279277
on: {
280278
REFRESH_WORKSPACE: {
281-
actions: [
282-
"refreshWorkspace",
283-
"clearRefreshWorkspaceWarning",
284-
],
279+
actions: ["refreshWorkspace"],
285280
},
286281
EVENT_SOURCE_ERROR: {
287282
target: "error",
288283
},
289284
},
290285
},
291286
error: {
292-
entry: "assignRefreshWorkspaceWarning",
287+
entry: "logWatchWorkspaceWarning",
293288
after: {
294289
"2000": {
295290
target: "gettingEvents",
@@ -586,12 +581,9 @@ export const workspaceMachine = createMachine(
586581
refreshWorkspace: assign({
587582
workspace: (_, event) => event.data,
588583
}),
589-
assignRefreshWorkspaceWarning: assign({
590-
refreshWorkspaceWarning: (_, event) => event,
591-
}),
592-
clearRefreshWorkspaceWarning: assign({
593-
refreshWorkspaceWarning: (_) => undefined,
594-
}),
584+
logWatchWorkspaceWarning: (_, event) => {
585+
console.error("Watch workspace error:", event)
586+
},
595587
assignGetTemplateWarning: assign({
596588
getTemplateWarning: (_, event) => event.data,
597589
}),

0 commit comments

Comments
 (0)