diff --git a/site/src/xServices/audit/auditXService.ts b/site/src/xServices/audit/auditXService.ts index b26fcb1313583..2ab414900d79b 100644 --- a/site/src/xServices/audit/auditXService.ts +++ b/site/src/xServices/audit/auditXService.ts @@ -7,6 +7,8 @@ import { assign, createMachine } from "xstate" export const auditMachine = createMachine( { id: "auditMachine", + predictableActionArguments: true, + tsTypes: {} as import("./auditXService.typegen").Typegen0, schema: { context: {} as { auditLogs?: AuditLog[]; count?: number; page: number; limit: number }, services: {} as { @@ -29,7 +31,6 @@ export const auditMachine = createMachine( page: number }, }, - tsTypes: {} as import("./auditXService.typegen").Typegen0, initial: "loading", states: { loading: { diff --git a/site/src/xServices/auth/authXService.ts b/site/src/xServices/auth/authXService.ts index d3c0a27ab2bd2..b90d0d7321b97 100644 --- a/site/src/xServices/auth/authXService.ts +++ b/site/src/xServices/auth/authXService.ts @@ -91,14 +91,8 @@ export const authMachine = /** @xstate-layout N4IgpgJg5mDOIC5QEMCuAXAFgZXc9YAdLAJZQB2kA8hgMTYCSA4gHID6DLioADgPal0JPuW4gAHogBsATimEAzDIAcAFgUB2VTJ26ANCACeiAIwaADKsLKFtu-dsBfRwbRZc+IqQolyUBuS0ECJEvgBufADWXmTkAWL8gsKiSBKICubKhKpSyhoArAbGCGaqGoRSlVXVlfnOrhg4eATEsb7+gWAATl18XYQ8ADb4AGZ9ALatFPGpiSRCImKSCLLySmqa2ro6RaYFAEzWDscK9SBuTZ6EMOhCfgCqsN1BIYThUUQ3ALJgCQLzySW6Uy2VyBV2JXyUhMFRqcLqLnOjQ8LRudygj2e3V6-SGowm1zA6B+fySi1Sy32MnyhHyyksYK2ug0EJM1IURxO9jOFxRnyJ6IACt1xiRYKQRLAXpQ3uQItFCABjTBgRWRYVdUXi5LwWb-BYpUDLZRScygvKFIyIGQaQ4FHnI5r827tDVaiXkKXYvoDYboMaapUqtVusUe3W8fWAimIE1mnIW1l0rImOE1BENdxOwkuvw-LB8CBS4Iy94K75EzCFiMgOYGoEIZRUwgyVT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SD6XmuyDOGeiMZXQJlgCmTMkp2LGm1OUFCHQORGkyEVqoZQbTNly2-poaERy6kh0pYl5LrZpLNIy1l2Sm5dAkPRs4wz+NlDOGcEAA */ createMachine( { - context: { - me: undefined, - getUserError: undefined, - authError: undefined, - updateProfileError: undefined, - methods: undefined, - getMethodsError: undefined, - }, + id: "authState", + predictableActionArguments: true, tsTypes: {} as import("./authXService.typegen").Typegen0, schema: { context: {} as AuthContext, @@ -133,7 +127,14 @@ export const authMachine = } }, }, - id: "authState", + context: { + me: undefined, + getUserError: undefined, + authError: undefined, + updateProfileError: undefined, + methods: undefined, + getMethodsError: undefined, + }, initial: "gettingUser", states: { signedOut: { diff --git a/site/src/xServices/buildInfo/buildInfoXService.ts b/site/src/xServices/buildInfo/buildInfoXService.ts index f5cfc8bf7ac45..56948865012fa 100644 --- a/site/src/xServices/buildInfo/buildInfoXService.ts +++ b/site/src/xServices/buildInfo/buildInfoXService.ts @@ -9,6 +9,8 @@ export interface BuildInfoContext { export const buildInfoMachine = createMachine( { + id: "buildInfoState", + predictableActionArguments: true, tsTypes: {} as import("./buildInfoXService.typegen").Typegen0, schema: { context: {} as BuildInfoContext, @@ -21,7 +23,6 @@ export const buildInfoMachine = createMachine( context: { buildInfo: undefined, }, - id: "buildInfoState", initial: "gettingBuildInfo", states: { gettingBuildInfo: { diff --git a/site/src/xServices/createWorkspace/createWorkspaceXService.ts b/site/src/xServices/createWorkspace/createWorkspaceXService.ts index ec679731036f1..a63605852183f 100644 --- a/site/src/xServices/createWorkspace/createWorkspaceXService.ts +++ b/site/src/xServices/createWorkspace/createWorkspaceXService.ts @@ -28,7 +28,8 @@ type CreateWorkspaceEvent = { export const createWorkspaceMachine = createMachine( { id: "createWorkspaceState", - initial: "gettingTemplates", + predictableActionArguments: true, + tsTypes: {} as import("./createWorkspaceXService.typegen").Typegen0, schema: { context: {} as CreateWorkspaceContext, events: {} as CreateWorkspaceEvent, @@ -44,7 +45,7 @@ export const createWorkspaceMachine = createMachine( } }, }, - tsTypes: {} as import("./createWorkspaceXService.typegen").Typegen0, + initial: "gettingTemplates", states: { gettingTemplates: { entry: "clearGetTemplatesError", diff --git a/site/src/xServices/entitlements/entitlementsXService.ts b/site/src/xServices/entitlements/entitlementsXService.ts index 0da90acd79237..3eee8a5e43ac6 100644 --- a/site/src/xServices/entitlements/entitlementsXService.ts +++ b/site/src/xServices/entitlements/entitlementsXService.ts @@ -28,7 +28,8 @@ const emptyEntitlements = { export const entitlementsMachine = createMachine( { id: "entitlementsMachine", - initial: "idle", + predictableActionArguments: true, + tsTypes: {} as import("./entitlementsXService.typegen").Typegen0, schema: { context: {} as EntitlementsContext, events: {} as EntitlementsEvent, @@ -38,10 +39,10 @@ export const entitlementsMachine = createMachine( }, }, }, - tsTypes: {} as import("./entitlementsXService.typegen").Typegen0, context: { entitlements: emptyEntitlements, }, + initial: "idle", states: { idle: { on: { diff --git a/site/src/xServices/roles/siteRolesXService.ts b/site/src/xServices/roles/siteRolesXService.ts index ee9eaa47d8198..0f100be2d85f1 100644 --- a/site/src/xServices/roles/siteRolesXService.ts +++ b/site/src/xServices/roles/siteRolesXService.ts @@ -19,7 +19,8 @@ type SiteRolesEvent = { export const siteRolesMachine = createMachine( { id: "siteRolesState", - initial: "idle", + predictableActionArguments: true, + tsTypes: {} as import("./siteRolesXService.typegen").Typegen0, schema: { context: {} as SiteRolesContext, events: {} as SiteRolesEvent, @@ -29,7 +30,7 @@ export const siteRolesMachine = createMachine( }, }, }, - tsTypes: {} as import("./siteRolesXService.typegen").Typegen0, + initial: "idle", states: { idle: { on: { diff --git a/site/src/xServices/setup/setupXService.ts b/site/src/xServices/setup/setupXService.ts index 564d1fb6b9d14..4d02c0b5b376b 100644 --- a/site/src/xServices/setup/setupXService.ts +++ b/site/src/xServices/setup/setupXService.ts @@ -26,6 +26,8 @@ export const setupMachine = /** @xstate-layout N4IgpgJg5mDOIC5QGUwBcCuAHZaCGaYAdAJYQA2YAxAMIBKAogIIAqDA+gGICSdyL7AKrIGdRKCwB7WCTQlJAO3EgAHogDMAViKaAnPoDsABgBMRgCy6jpkwBoQAT0QBGI+qIA2N0ePOAHJqa-qYAviH2qJg4+IREAMYATmAEJApQnCQJsGiCsGAJVBCKxKkAbpIA1sSJyYQZWTl5CcpSMnKKymoI6ibuzmZGuiYG6kYemn4eHvZOCObOzjom-X7qHsZGmuq6mmER6Ni4BNVJKWn12bn5VPkJkglEWOQEAGb3ALbxp3WZl00t0lk8iUSFUGl07g8-XMxlWmmsWnUMxcUyIzg86hhPgWvg8JjC4RACkkEDgykihxiJQoYABbWBnUQflcRAMZlc6jWwwMfmRCDM2ksfgMzl0Bisbj85j8exAFOixy+tVS6V+jXydKBHVBXQAtDsiOyeVp-OoFrpnHyzboiKZ1CMDCNzEY-H4xbL5UdYi81VcEjRvpBNe0QaAuoEbZzpfaRh4rFM+eYTOZbcsTBD0b0bB6DgrCMGGTrELrzYajM5jUFVubLY4NIsvKM2eMtKZNOMCSEgA */ createMachine( { + id: "SetupState", + predictableActionArguments: true, tsTypes: {} as import("./setupXService.typegen").Typegen0, schema: { context: {} as SetupContext, @@ -36,7 +38,6 @@ export const setupMachine = } }, }, - id: "SetupState", initial: "idle", states: { idle: { diff --git a/site/src/xServices/template/templateXService.ts b/site/src/xServices/template/templateXService.ts index 701b0095c16a4..671cb9cf2d643 100644 --- a/site/src/xServices/template/templateXService.ts +++ b/site/src/xServices/template/templateXService.ts @@ -33,6 +33,8 @@ export const templateMachine = /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOhgBdyCoAVMVABwBt1ywBiCAe0JIIDcuAazAk0WPIVIUq+WvWaswCAV0ytcPANoAGALqJQDLrFxUehkAA9EAJgDsOkgGZbO2wE5bANg8BGABZnHR0AgBoQAE9EPx0-Eg9EpIAOe28-D28ggF9siPEcAmI+fDNcdCYASXwAMy4SLCp+MDpGFjYANTAAJ1MeMjBKagBBTCaWhXawLt7NfE4eUVURMQxCqRKyiuq6hrHcZtbFTp6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tWfvaL0hWm2rfcRXHxBR2M2+l2NdVfWxeNuHbW7Xz+xCWJkm8ZE3LbRO1zV12S0jRVzpFwH8F9inM4D03u2Ux6sWvQj2wTjH4qd5PQzrvMG-nYnSYz0TQRNG3gnUyE+zNNv-EevDrUya9mr7kiVexlPRoJxujdE7O7r8gIO+dXtUkyMvVazSfrt8bt7xpgcFttC1nXsROPy-SBH5w1iO6MKwRghAkbH2BSUtHBrTRPeC8rhxKJ30hRKiNF2psEAS3ZCNMkR4R8MOWqfloEIntCvDmnoRzyUIvLRO6VWTYP+F4TCNt0g22REhV6pCYgEJIPVDENsPBpA9GkehmCAHjREtdVmmFPCKy2u6RwcJzaQicMOb0wQ3ALVxNvXSRAmExBUWQvOA5baqXlrbXIuQgA */ createMachine( { + id: "templateMachine", + predictableActionArguments: true, tsTypes: {} as import("./templateXService.typegen").Typegen0, schema: { context: {} as TemplateContext, @@ -58,7 +60,6 @@ export const templateMachine = } }, }, - id: "(machine)", initial: "gettingTemplate", states: { gettingTemplate: { diff --git a/site/src/xServices/templateSettings/templateSettingsXService.ts b/site/src/xServices/templateSettings/templateSettingsXService.ts index de80fbcedc842..d0fce5d9b4ee0 100644 --- a/site/src/xServices/templateSettings/templateSettingsXService.ts +++ b/site/src/xServices/templateSettings/templateSettingsXService.ts @@ -7,7 +7,9 @@ export const templateSettingsMachine = /** @xstate-layout N4IgpgJg5mDOIC5QBcwFsAOAbAhqgymMsgJYB2UsAdFgPY4TlQDEEtZYV5AbrQNadUmXASKkK1OgyYIetAMZ4S7ANoAGALqJQGWrBKl22kAA9EANgCMVAKwB2AByWATJbWWAnABYv55w-MAGhAAT0RnAGZnKgibGw9nD3M1JJsHNQiAX0zgoWw8MEJiJmpIAyZmfABBADUAUWNdfUMyYzMESx9bSK8IhwdncwcbF2dgsIRejypzX2dXf09zCLUbbNz0fNFiiSpYHG4Ktg4uMl4BKjyRQrESvYOZOUUW9S0kECbyo3f25KoHOxeDwODx9EYeNTzcYWGxqKgeGw+SJ2cx+VZebI5EBkWgQODGK4FIriSg0eiMCiNPRfVo-RBeMahRAQqhqNnuWERFFeOyedYgQnbEmlRgkqnNZS00DtSwRcz-EY2PzeeYOLk2aEIWJ2WwOIEBNIeBG8-mCm47Un7Q6U96fFptenWRJDIZy+y9AFBJkIEbRbxeWUBRwIyx2U2ba7Eu5WyDimkOhAI2yxSx+foMpWWTV2RLJgIrPoA4bh4RE24SOP2ukdHXOgJq8zuvoozWWBys9nzSydNt2NQYzFAA */ createMachine( { - initial: "loading", + id: "templateSettings", + predictableActionArguments: true, + tsTypes: {} as import("./templateSettingsXService.typegen").Typegen0, schema: {} as { context: { organizationId: string @@ -26,7 +28,7 @@ export const templateSettingsMachine = } events: { type: "SAVE"; templateSettings: UpdateTemplateMeta } }, - tsTypes: {} as import("./templateSettingsXService.typegen").Typegen0, + initial: "loading", states: { loading: { invoke: { @@ -71,7 +73,6 @@ export const templateSettingsMachine = type: "final", }, }, - id: "templateSettings", }, { services: { diff --git a/site/src/xServices/templates/templatesXService.ts b/site/src/xServices/templates/templatesXService.ts index 139d0e8e454c5..119421936727c 100644 --- a/site/src/xServices/templates/templatesXService.ts +++ b/site/src/xServices/templates/templatesXService.ts @@ -10,97 +10,88 @@ interface TemplatesContext { getTemplatesError?: Error | unknown } -export const templatesMachine = - /** @xstate-layout N4IgpgJg5mDOIC5QBcwFsAOAbAhq2AysnmAHQzLICWAdlAPIBOUONVAXnlQPY2wDEEXmVoA3bgGsyFJizadqveEhAZusKopqJQAD0QAWAMwHSATgDsANgCsAJgt2rRuwAYAHBYsAaEAE9EAEZAu1IDMwiIm3dXG0DjdwBfRN9UTFx8IhJyMEpaBmZWDi4lfjBGRm5GUmw8ADMqtBzkWSKFHj4dVXVNDq79BGNTS1sHJxcPL18AhBMjUhtXJaWrOzM7O3cDG2TU9FrM4lRm6joAFX2MuEFhUjFJaVyL9JJlUDUNLX6gpeH1wJcIQs7giVmmiBB5kilgM7iMHmcOxSIDSBzgWWOFFOUGeaIE5Uq1QODUYTQouKub26nz6KgGgV+ULsAOZDhBZjB-kQbhspGWSxC0W2VncSORNG4EDgXVRlIxjzydFa8hKnRUH16vG+gzs4IQwTMYWhjgsRjm9l2KMur3lJ3yFNeXQ1XzpiCsVlcpFW4QMFnisJZeo5UMicQsNjMgRsSL2L0O2SENDATp6Lr0QTcFjCa2cfqsgRNeuC7j5-Ncq3WmwMgUtsptRzIBKqKZpWtd+sz2Y5RjzBYceo2WbNw9hrijZtr1vjqBbmu07cC7iLSWSiSAA */ - createMachine( - { - tsTypes: {} as import("./templatesXService.typegen").Typegen0, - schema: { - context: {} as TemplatesContext, - services: {} as { - getOrganizations: { - data: TypesGen.Organization[] - } - getTemplates: { - data: TypesGen.Template[] - } - }, +export const templatesMachine = createMachine( + { + id: "templatesState", + predictableActionArguments: true, + tsTypes: {} as import("./templatesXService.typegen").Typegen0, + schema: { + context: {} as TemplatesContext, + services: {} as { + getOrganizations: { + data: TypesGen.Organization[] + } + getTemplates: { + data: TypesGen.Template[] + } }, - id: "templatesState", - initial: "gettingOrganizations", - states: { - gettingOrganizations: { - entry: "clearGetOrganizationsError", - invoke: { - src: "getOrganizations", - id: "getOrganizations", - onDone: [ - { - actions: ["assignOrganizations"], - target: "gettingTemplates", - }, - ], - onError: [ - { - actions: "assignGetOrganizationsError", - target: "error", - }, - ], + }, + initial: "gettingOrganizations", + states: { + gettingOrganizations: { + entry: "clearGetOrganizationsError", + invoke: { + src: "getOrganizations", + id: "getOrganizations", + onDone: { + actions: ["assignOrganizations"], + target: "gettingTemplates", + }, + onError: { + actions: "assignGetOrganizationsError", + target: "error", }, - tags: "loading", }, - gettingTemplates: { - entry: "clearGetTemplatesError", - invoke: { - src: "getTemplates", - id: "getTemplates", - onDone: [ - { - actions: ["assignTemplates"], - target: "done", - }, - ], - onError: [ - { - actions: "assignGetTemplatesError", - target: "error", - }, - ], + tags: "loading", + }, + gettingTemplates: { + entry: "clearGetTemplatesError", + invoke: { + src: "getTemplates", + id: "getTemplates", + onDone: { + actions: "assignTemplates", + target: "done", + }, + onError: { + actions: "assignGetTemplatesError", + target: "error", }, - tags: "loading", }, - done: {}, - error: {}, + tags: "loading", }, + done: {}, + error: {}, }, - { - actions: { - assignOrganizations: assign({ - organizations: (_, event) => event.data, - }), - assignGetOrganizationsError: assign({ - getOrganizationsError: (_, event) => event.data, - }), - clearGetOrganizationsError: assign((context) => ({ - ...context, - getOrganizationsError: undefined, - })), - assignTemplates: assign({ - templates: (_, event) => event.data, - }), - assignGetTemplatesError: assign({ - getTemplatesError: (_, event) => event.data, - }), - clearGetTemplatesError: (context) => assign({ ...context, getTemplatesError: undefined }), - }, - services: { - getOrganizations: API.getOrganizations, - getTemplates: async (context) => { - if (!context.organizations || context.organizations.length === 0) { - throw new Error("no organizations") - } - return API.getTemplates(context.organizations[0].id) - }, + }, + { + actions: { + assignOrganizations: assign({ + organizations: (_, event) => event.data, + }), + assignGetOrganizationsError: assign({ + getOrganizationsError: (_, event) => event.data, + }), + clearGetOrganizationsError: assign((context) => ({ + ...context, + getOrganizationsError: undefined, + })), + assignTemplates: assign({ + templates: (_, event) => event.data, + }), + assignGetTemplatesError: assign({ + getTemplatesError: (_, event) => event.data, + }), + clearGetTemplatesError: (context) => assign({ ...context, getTemplatesError: undefined }), + }, + services: { + getOrganizations: API.getOrganizations, + getTemplates: async (context) => { + if (!context.organizations || context.organizations.length === 0) { + throw new Error("no organizations") + } + return API.getTemplates(context.organizations[0].id) }, }, - ) + }, +) diff --git a/site/src/xServices/terminal/terminalXService.ts b/site/src/xServices/terminal/terminalXService.ts index 8e0fee2be305a..3689e831bdcda 100644 --- a/site/src/xServices/terminal/terminalXService.ts +++ b/site/src/xServices/terminal/terminalXService.ts @@ -37,6 +37,8 @@ export const terminalMachine = /** @xstate-layout N4IgpgJg5mDOIC5QBcwCcC2BLAdgQwBsBlZPVAOhmWVygHk0o8csAvMrAex1gGIJuYcrgBunANZCqDJi3Y1u8JCAAOnWFgU5EoAB6IA7AE4AzOSMBGAEwB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mNSxHhKW4BiGERUzeUUxSj6EMwN4HM5ukLLXBViRKGNhXVj64etM0JOG5YTC1kktORlp7hA4CtK2DYEALQQ8M5FKQd27OJTNVAA */ createMachine( { + id: "terminalState", + predictableActionArguments: true, tsTypes: {} as import("./terminalXService.typegen").Typegen0, schema: { context: {} as TerminalContext, @@ -53,7 +55,6 @@ export const terminalMachine = } }, }, - id: "terminalState", initial: "gettingWorkspace", states: { gettingWorkspace: { diff --git a/site/src/xServices/users/usersXService.ts b/site/src/xServices/users/usersXService.ts index 316322f78e539..9a64224242e1c 100644 --- a/site/src/xServices/users/usersXService.ts +++ b/site/src/xServices/users/usersXService.ts @@ -79,6 +79,8 @@ export type UsersEvent = export const usersMachine = createMachine( { + id: "usersState", + predictableActionArguments: true, tsTypes: {} as import("./usersXService.typegen").Typegen0, schema: { context: {} as UsersContext, @@ -107,7 +109,6 @@ export const usersMachine = createMachine( } }, }, - id: "usersState", initial: "idle", states: { idle: { diff --git a/site/src/xServices/workspace/workspaceXService.ts b/site/src/xServices/workspace/workspaceXService.ts index 1f3b8192977fb..94c1a02c220b0 100644 --- a/site/src/xServices/workspace/workspaceXService.ts +++ b/site/src/xServices/workspace/workspaceXService.ts @@ -81,6 +81,8 @@ const permissionsToCheck = (workspace: TypesGen.Workspace) => ({ export const workspaceMachine = createMachine( { + id: "workspaceState", + predictableActionArguments: true, tsTypes: {} as import("./workspaceXService.typegen").Typegen0, schema: { context: {} as WorkspaceContext, @@ -124,10 +126,12 @@ export const workspaceMachine = createMachine( } }, }, - id: "workspaceState", initial: "idle", on: { - GET_WORKSPACE: "gettingWorkspace", + GET_WORKSPACE: { + target: ".gettingWorkspace", + internal: false, + }, }, states: { idle: { @@ -138,30 +142,38 @@ export const workspaceMachine = createMachine( invoke: { src: "getWorkspace", id: "getWorkspace", - onDone: { - target: "refreshingTemplate", - actions: ["assignWorkspace"], - }, - onError: { - target: "error", - actions: "assignGetWorkspaceError", - }, + onDone: [ + { + actions: "assignWorkspace", + target: "refreshingTemplate", + }, + ], + onError: [ + { + actions: "assignGetWorkspaceError", + target: "error", + }, + ], }, tags: "loading", }, refreshingTemplate: { - entry: ["clearRefreshTemplateError"], + entry: "clearRefreshTemplateError", invoke: { - id: "refreshTemplate", src: "getTemplate", - onDone: { - target: "gettingPermissions", - actions: ["assignTemplate"], - }, - onError: { - target: "error", - actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"], - }, + id: "refreshTemplate", + onDone: [ + { + actions: "assignTemplate", + target: "gettingPermissions", + }, + ], + onError: [ + { + actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"], + target: "error", + }, + ], }, tags: "loading", }, @@ -172,7 +184,7 @@ export const workspaceMachine = createMachine( id: "checkPermissions", onDone: [ { - actions: ["assignPermissions"], + actions: "assignPermissions", target: "ready", }, ], @@ -187,22 +199,33 @@ export const workspaceMachine = createMachine( ready: { type: "parallel", states: { - // We poll the workspace consistently to know if it becomes outdated and to update build status pollingWorkspace: { initial: "refreshingWorkspace", states: { refreshingWorkspace: { entry: "clearRefreshWorkspaceError", invoke: { - id: "refreshWorkspace", src: "refreshWorkspace", - onDone: { target: "waiting", actions: ["refreshTimeline", "assignWorkspace"] }, - onError: { target: "waiting", actions: "assignRefreshWorkspaceError" }, + id: "refreshWorkspace", + onDone: [ + { + actions: ["refreshTimeline", "assignWorkspace"], + target: "waiting", + }, + ], + onError: [ + { + actions: "assignRefreshWorkspaceError", + target: "waiting", + }, + ], }, }, waiting: { after: { - 1000: "refreshingWorkspace", + "1000": { + target: "refreshingWorkspace", + }, }, }, }, @@ -221,8 +244,12 @@ export const workspaceMachine = createMachine( }, askingDelete: { on: { - DELETE: "requestingDelete", - CANCEL_DELETE: "idle", + DELETE: { + target: "requestingDelete", + }, + CANCEL_DELETE: { + target: "idle", + }, }, }, requestingStartWithLatestTemplate: { @@ -243,80 +270,100 @@ export const workspaceMachine = createMachine( requestingStart: { entry: "clearBuildError", invoke: { - id: "startWorkspace", src: "startWorkspace", - onDone: { - target: "idle", - actions: ["assignBuild", "refreshTimeline"], - }, - onError: { - target: "idle", - actions: ["assignBuildError"], - }, + id: "startWorkspace", + onDone: [ + { + actions: ["assignBuild", "refreshTimeline"], + target: "idle", + }, + ], + onError: [ + { + actions: "assignBuildError", + target: "idle", + }, + ], }, }, requestingStop: { entry: "clearBuildError", invoke: { - id: "stopWorkspace", src: "stopWorkspace", - onDone: { - target: "idle", - actions: ["assignBuild", "refreshTimeline"], - }, - onError: { - target: "idle", - actions: ["assignBuildError"], - }, + id: "stopWorkspace", + onDone: [ + { + actions: ["assignBuild", "refreshTimeline"], + target: "idle", + }, + ], + onError: [ + { + actions: "assignBuildError", + target: "idle", + }, + ], }, }, requestingDelete: { entry: "clearBuildError", invoke: { - id: "deleteWorkspace", src: "deleteWorkspace", - onDone: { - target: "idle", - actions: ["assignBuild", "refreshTimeline"], - }, - onError: { - target: "idle", - actions: ["assignBuildError"], - }, + id: "deleteWorkspace", + onDone: [ + { + actions: ["assignBuild", "refreshTimeline"], + target: "idle", + }, + ], + onError: [ + { + actions: "assignBuildError", + target: "idle", + }, + ], }, }, requestingCancel: { entry: ["clearCancellationMessage", "clearCancellationError"], invoke: { - id: "cancelWorkspace", src: "cancelWorkspace", - onDone: { - target: "idle", - actions: [ - "assignCancellationMessage", - "displayCancellationMessage", - "refreshTimeline", - ], - }, - onError: { - target: "idle", - actions: ["assignCancellationError"], - }, + id: "cancelWorkspace", + onDone: [ + { + actions: [ + "assignCancellationMessage", + "displayCancellationMessage", + "refreshTimeline", + ], + target: "idle", + }, + ], + onError: [ + { + actions: "assignCancellationError", + target: "idle", + }, + ], }, }, refreshingTemplate: { entry: "clearRefreshTemplateError", invoke: { - id: "refreshTemplate", src: "getTemplate", - onDone: { - target: "requestingStart", - actions: "assignTemplate", - }, - onError: { - target: "idle", - actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"], - }, + id: "refreshTemplate", + onDone: [ + { + actions: "assignTemplate", + target: "requestingStart", + }, + ], + onError: [ + { + actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"], + target: "idle", + }, + ], }, }, }, @@ -327,20 +374,31 @@ export const workspaceMachine = createMachine( gettingResources: { entry: "clearGetResourcesError", invoke: { - id: "getResources", src: "getResources", - onDone: { target: "waiting", actions: "assignResources" }, - onError: { target: "waiting", actions: "assignGetResourcesError" }, + id: "getResources", + onDone: [ + { + actions: "assignResources", + target: "waiting", + }, + ], + onError: [ + { + actions: "assignGetResourcesError", + target: "waiting", + }, + ], }, }, waiting: { after: { - 5000: "gettingResources", + "5000": { + target: "gettingResources", + }, }, }, }, }, - timeline: { initial: "gettingBuilds", states: { @@ -349,14 +407,18 @@ export const workspaceMachine = createMachine( entry: "clearGetBuildsError", invoke: { src: "getBuilds", - onDone: { - actions: ["assignBuilds"], - target: "loadedBuilds", - }, - onError: { - actions: ["assignGetBuildsError"], - target: "idle", - }, + onDone: [ + { + actions: "assignBuilds", + target: "loadedBuilds", + }, + ], + onError: [ + { + actions: "assignGetBuildsError", + target: "idle", + }, + ], }, }, loadedBuilds: { @@ -365,24 +427,30 @@ export const workspaceMachine = createMachine( idle: { on: { LOAD_MORE_BUILDS: { - target: "loadingMoreBuilds", cond: "hasMoreBuilds", + target: "loadingMoreBuilds", + }, + REFRESH_TIMELINE: { + target: "#workspaceState.ready.timeline.gettingBuilds", }, - REFRESH_TIMELINE: "#workspaceState.ready.timeline.gettingBuilds", }, }, loadingMoreBuilds: { entry: "clearLoadMoreBuildsError", invoke: { src: "loadMoreBuilds", - onDone: { - actions: ["assignNewBuilds"], - target: "idle", - }, - onError: { - actions: ["assignLoadMoreBuildsError"], - target: "idle", - }, + onDone: [ + { + actions: "assignNewBuilds", + target: "idle", + }, + ], + onError: [ + { + actions: "assignLoadMoreBuildsError", + target: "idle", + }, + ], }, }, }, @@ -393,7 +461,9 @@ export const workspaceMachine = createMachine( }, error: { on: { - GET_WORKSPACE: "gettingWorkspace", + GET_WORKSPACE: { + target: "gettingWorkspace", + }, }, }, }, diff --git a/site/src/xServices/workspaceBuild/workspaceBuildXService.ts b/site/src/xServices/workspaceBuild/workspaceBuildXService.ts index b49fa75a98e31..cbe080e0dbda7 100644 --- a/site/src/xServices/workspaceBuild/workspaceBuildXService.ts +++ b/site/src/xServices/workspaceBuild/workspaceBuildXService.ts @@ -24,6 +24,8 @@ type LogsEvent = { export const workspaceBuildMachine = createMachine( { id: "workspaceBuildState", + predictableActionArguments: true, + tsTypes: {} as import("./workspaceBuildXService.typegen").Typegen0, schema: { context: {} as LogsContext, events: {} as LogsEvent, @@ -36,7 +38,6 @@ export const workspaceBuildMachine = createMachine( } }, }, - tsTypes: {} as import("./workspaceBuildXService.typegen").Typegen0, initial: "gettingBuild", states: { gettingBuild: { diff --git a/site/src/xServices/workspaceSchedule/workspaceScheduleBannerXService.ts b/site/src/xServices/workspaceSchedule/workspaceScheduleBannerXService.ts index 007cd862c1835..5dd803bc3b9ae 100644 --- a/site/src/xServices/workspaceSchedule/workspaceScheduleBannerXService.ts +++ b/site/src/xServices/workspaceSchedule/workspaceScheduleBannerXService.ts @@ -21,11 +21,12 @@ export type WorkspaceScheduleBannerEvent = { export const workspaceScheduleBannerMachine = createMachine( { + id: "workspaceScheduleBannerState", + predictableActionArguments: true, tsTypes: {} as import("./workspaceScheduleBannerXService.typegen").Typegen0, schema: { events: {} as WorkspaceScheduleBannerEvent, }, - id: "workspaceScheduleBannerState", initial: "idle", states: { idle: { diff --git a/site/src/xServices/workspaceSchedule/workspaceScheduleXService.ts b/site/src/xServices/workspaceSchedule/workspaceScheduleXService.ts index 9fef3b34cd0f4..be45a8fdcb075 100644 --- a/site/src/xServices/workspaceSchedule/workspaceScheduleXService.ts +++ b/site/src/xServices/workspaceSchedule/workspaceScheduleXService.ts @@ -53,6 +53,8 @@ export type WorkspaceScheduleEvent = export const workspaceSchedule = createMachine( { + id: "workspaceScheduleState", + predictableActionArguments: true, tsTypes: {} as import("./workspaceScheduleXService.typegen").Typegen0, schema: { context: {} as WorkspaceScheduleContext, @@ -63,7 +65,6 @@ export const workspaceSchedule = createMachine( } }, }, - id: "workspaceScheduleState", initial: "idle", on: { GET_WORKSPACE: "gettingWorkspace", diff --git a/site/src/xServices/workspaces/workspacesXService.ts b/site/src/xServices/workspaces/workspacesXService.ts index 9bc3df854b711..026efec7ff1e4 100644 --- a/site/src/xServices/workspaces/workspacesXService.ts +++ b/site/src/xServices/workspaces/workspacesXService.ts @@ -28,6 +28,8 @@ type WorkspaceItemEvent = export const workspaceItemMachine = createMachine( { id: "workspaceItemMachine", + predictableActionArguments: true, + tsTypes: {} as import("./workspacesXService.typegen").Typegen0, schema: { context: {} as WorkspaceItemContext, events: {} as WorkspaceItemEvent, @@ -43,7 +45,6 @@ export const workspaceItemMachine = createMachine( } }, }, - tsTypes: {} as import("./workspacesXService.typegen").Typegen0, type: "parallel", states: { @@ -196,6 +197,7 @@ type WorkspacesEvent = export const workspacesMachine = createMachine( { + predictableActionArguments: true, tsTypes: {} as import("./workspacesXService.typegen").Typegen1, schema: { context: {} as WorkspacesContext,