Skip to content

Commit

Permalink
fix: pause state not saved to restore point
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-Arc committed Jan 26, 2025
1 parent 4a45c69 commit 8488ffe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/services/runtime-service/RuntimeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
!deepEqual(RuntimeService.previousState?.runtime, state.runtime);

/**
* the currentBlock object has no ticking values so we only need to check for equallety
* the currentBlock object has no ticking values so we only need to check for equality
*/
const shouldBlockUpdate = !deepEqual(RuntimeService?.previousState.currentBlock, state.currentBlock);

Expand Down
6 changes: 5 additions & 1 deletion apps/server/src/stores/runtimeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,14 @@ export function clear() {
* Utility to allow modifying the state from the outside
* @param newState
*/
function patchTimer(newState: Partial<TimerState>) {
function patchTimer(newState: Partial<TimerState & RestorePoint>) {
for (const key in newState) {
if (key in runtimeState.timer) {
runtimeState.timer[key] = newState[key];
} else if (key in runtimeState._timer) {
// in case of a RestorePoint we will receive a pausedAt value
// wiche is needed to resume a paused timer
runtimeState._timer[key] = newState[key];
}
}
}
Expand Down

0 comments on commit 8488ffe

Please sign in to comment.