mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-11 23:14:58 -05:00
fix(editor): block rename applies to correct block when selection changes (#3129)
This commit is contained in:
@@ -130,6 +130,7 @@ export class ExecutionEngine {
|
||||
this.context.metadata.duration = endTime - startTime
|
||||
|
||||
if (this.cancelledFlag) {
|
||||
this.finalizeIncompleteLogs()
|
||||
return {
|
||||
success: false,
|
||||
output: this.finalOutput,
|
||||
@@ -151,6 +152,7 @@ export class ExecutionEngine {
|
||||
this.context.metadata.duration = endTime - startTime
|
||||
|
||||
if (this.cancelledFlag) {
|
||||
this.finalizeIncompleteLogs()
|
||||
return {
|
||||
success: false,
|
||||
output: this.finalOutput,
|
||||
@@ -474,4 +476,20 @@ export class ExecutionEngine {
|
||||
pauseCount: responses.length,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalizes any block logs that were still running when execution was cancelled.
|
||||
* Sets their endedAt to now and calculates the actual elapsed duration.
|
||||
*/
|
||||
private finalizeIncompleteLogs(): void {
|
||||
const now = new Date()
|
||||
const nowIso = now.toISOString()
|
||||
|
||||
for (const log of this.context.blockLogs) {
|
||||
if (!log.endedAt) {
|
||||
log.endedAt = nowIso
|
||||
log.durationMs = now.getTime() - new Date(log.startedAt).getTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user