Skip to content

Commit 85ad1a2

Browse files
Update the project when an action recording is added
1 parent 328c2e9 commit 85ad1a2

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/store.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ const createMlStore = (logging: Logging) => {
468468
},
469469

470470
async addActionRecording(id: string, recording: RecordingData) {
471-
const { actions } = get();
471+
const { actions, dataWindow, project, projectEdited } = get();
472472
let updatedAction: ActionData;
473473
const updatedActions = actions.map((action) => {
474474
if (action.id === id) {
@@ -480,13 +480,25 @@ const createMlStore = (logging: Logging) => {
480480
}
481481
return action;
482482
});
483+
const updatedProject = updateProject(
484+
project,
485+
projectEdited,
486+
updatedActions,
487+
undefined,
488+
dataWindow
489+
);
483490
set({
484491
actions: updatedActions,
485492
model: undefined,
493+
...updatedProject,
486494
});
487-
await storageWithErrHandling<void>(() =>
488-
storage.addRecording(recording, updatedAction)
489-
);
495+
await storageWithErrHandling<string | void>([
496+
storage.addRecording(recording, updatedAction!),
497+
storage.updateMakeCodeProject({
498+
project: updatedProject.project,
499+
projectEdited: updatedProject.projectEdited,
500+
}),
501+
]);
490502
},
491503

492504
async deleteAction(action: ActionData) {

0 commit comments

Comments
 (0)