Skip to content

Commit

Permalink
Add additional action for a workspace lifecycle event. (#703)
Browse files Browse the repository at this point in the history
Added an extra action to make it clear when a workspace was applied. Updated impacted modules.
  • Loading branch information
johnman authored Apr 10, 2024
1 parent cc04289 commit eccfe0b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## v18.0.0

- Improvement: Added `apply` as an action on the WorkspaceChangedLifecyclePayload. Previously we had `create`, `update`, `delete`. `update` was being fired when a workspace was updated and when a workspace was applied. `apply` now makes it clear when a particular workspace platform override has been triggered.
- Improvement: modules/integrations/workspaces this module now refreshes the entries when a workspace is applied. So if a workspace entry in Home said it was selected it would be updated and the newly selected workspace would be updated to reflect it is the currently selected workspace.
- Updated: modules/composite/default-workspace/lifecycle logic to listen out for the new `apply` action.
- Added support for rspack for faster builds. `npm run build-client-rspack` will npx install rspack and use the webpack config file to build the JavaScript from the TypeScript files. It is faster but no type checking is performed so we still recommend doing validated builds using `npm run build` or `npm run build-client`.
- Improved performance of switching schemes
- Improved performance of computing dock configuration, especially on theme changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export function overrideCallback(
}

await fireLifecycleEvent<WorkspaceChangedLifecyclePayload>(platform, "workspace-changed", {
action: "update",
action: "apply",
id: payload.workspaceId,
workspace: payload
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface WorkspaceChangedLifecyclePayload {
/**
* The action that happened to the workspace.
*/
action: "create" | "update" | "delete";
action: "create" | "apply" | "update" | "delete";

/**
* The id of the workspace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export class ApplyDefaultWorkspaceProvider implements Lifecycle<DefaultWorkspace
if (!isEmpty(customData)) {
const workspaceUpdate = customData as WorkspaceChangedLifecyclePayload;
if (
(workspaceUpdate.action === "update" || workspaceUpdate.action === "create") &&
(workspaceUpdate.action === "update" ||
workspaceUpdate.action === "create" ||
workspaceUpdate.action === "apply") &&
!isEmpty(this._defaultWorkspaceStorage)
) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class WorkspacesProvider implements IntegrationModule<WorkspacesSettings>
platform: WorkspacePlatformModule,
payload?: WorkspaceChangedLifecyclePayload
): Promise<void> => {
if (payload?.action === "create") {
if (payload?.action === "create" || payload?.action === "apply") {
if (!isEmpty(this._lastQuery) && !this._lastQuery.startsWith("/w ")) {
await this.rebuildResults(platform);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface WorkspaceChangedLifecyclePayload {
/**
* The action that happened to the workspace.
*/
action: "create" | "update" | "delete";
action: "create" | "apply" | "update" | "delete";
/**
* The id of the workspace.
*/
Expand Down

0 comments on commit eccfe0b

Please sign in to comment.