Skip to content

Commit 7110aa3

Browse files
committed
Improve check on whether the live module has changed
1 parent 3a5e711 commit 7110aa3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/app/src/app/overmind/effects/live/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,10 @@ class Live {
552552
return this.clients.has(moduleShortid);
553553
}
554554

555+
getClient(moduleShortid: string) {
556+
return this.clients.get(moduleShortid);
557+
}
558+
555559
getAllClients() {
556560
return this.clients.getAll();
557561
}

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ export const codeChanged: Action<{
374374

375375
const savedCode = getSavedCode(module.code, module.savedCode);
376376
const isSavedCode = savedCode === code;
377-
const isFirstChange = !effects.live.hasClient(module.shortid);
377+
const isFirstChange =
378+
!effects.live.hasClient(module.shortid) ||
379+
(effects.live.getClient(moduleShortid).revision === 0 &&
380+
effects.live.getClient(moduleShortid).state.name === 'Synchronized');
378381

379382
// Don't send saved code of a moduke that has not been registered with yet, since the server
380383
// will take the saved code as base. Which means that the change that would generate the saved code

0 commit comments

Comments
 (0)