Skip to content

Commit

Permalink
fix(): also update brick tree before build
Browse files Browse the repository at this point in the history
Closes NEXT_BUILDER-3913
  • Loading branch information
nlicroshan committed Oct 16, 2023
1 parent 31544e4 commit 2433cf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bricks/next-builder/src/shared/workbench/WorkbenchBackend.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,14 @@ describe("WorkbenchBackend should work", () => {
jest.runAllTimers();
await (global as any).flushPromises();

expect(handleBackendMessage).toHaveBeenNthCalledWith(3, "message", {
expect(handleBackendMessage).toHaveBeenNthCalledWith(
3,
"message",
expect.objectContaining({
action: "update-graph-data",
})
);
expect(handleBackendMessage).toHaveBeenNthCalledWith(4, "message", {
action: "build-start",
});

Expand All @@ -192,7 +199,7 @@ describe("WorkbenchBackend should work", () => {
},
});

expect(handleBackendMessage).toHaveBeenNthCalledWith(4, "message", {
expect(handleBackendMessage).toHaveBeenNthCalledWith(5, "message", {
action: "build-success",
data: {
storyboard: {
Expand Down Expand Up @@ -360,7 +367,7 @@ describe("WorkbenchBackend should work", () => {
instanceId: "abc",
});

expect(handleBackendMessage).toBeCalledTimes(10);
expect(handleBackendMessage).toBeCalledTimes(11);
backendInstance.unsubscribe(listener);

backendInstance.push({
Expand All @@ -373,7 +380,7 @@ describe("WorkbenchBackend should work", () => {
});
await (global as any).flushPromises();

expect(handleBackendMessage).toBeCalledTimes(10);
expect(handleBackendMessage).toBeCalledTimes(11);

// @ts-ignore
backendInstance.mockNodeIdCache.set("mock_id_1", "new-id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ export default class WorkbenchBackend {
if (this.isBuilding) return;
this.isBuilding = true;
try {
await this.updateBrickTree();
// eslint-disable-next-line no-console
console.log("=== building ===");
this.publish("message", {
Expand Down

0 comments on commit 2433cf8

Please sign in to comment.