Skip to content

Commit 6ff0636

Browse files
committed
Correct the logic for checkpoint deletion undo functionality by checking for the 'Undo' confirmation choice
1 parent 3df922a commit 6ff0636

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

‎packages/vscode/src/commands/checkpoints-command/checkpoints-command.ts‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,17 @@ export const checkpoints_command = (
227227
CHECKPOINTS_STATE_KEY,
228228
checkpoints
229229
)
230-
await refresh_items()
231-
const active_item = quick_pick.items.find(
232-
(i) =>
233-
(i as any).checkpoint?.timestamp ===
234-
item.checkpoint?.timestamp
235-
)
236-
if (active_item) {
237-
quick_pick.activeItems = [active_item]
238-
}
230+
}
231+
}
232+
await refresh_items()
233+
if (new_description !== undefined) {
234+
const active_item = quick_pick.items.find(
235+
(i) =>
236+
(i as any).checkpoint?.timestamp ===
237+
item.checkpoint?.timestamp
238+
)
239+
if (active_item) {
240+
quick_pick.activeItems = [active_item]
239241
}
240242
}
241243
quick_pick.show()
@@ -245,9 +247,9 @@ export const checkpoints_command = (
245247
if (e.button.tooltip == 'Delete') {
246248
const deleted_checkpoint = item.checkpoint
247249
const real_index_in_state = checkpoints.findIndex(
248-
(c) => c.timestamp === deleted_checkpoint.timestamp
250+
(c) => c.timestamp == deleted_checkpoint.timestamp
249251
)
250-
if (real_index_in_state === -1) return
252+
if (real_index_in_state == -1) return
251253

252254
const original_checkpoint_from_state =
253255
checkpoints[real_index_in_state]
@@ -268,11 +270,11 @@ export const checkpoints_command = (
268270
`Checkpoint from ${dayjs(
269271
deleted_checkpoint.timestamp
270272
).fromNow()} deleted.`,
271-
'Revert'
273+
'Undo'
272274
)
273275
is_showing_dialog = false
274276

275-
if (choice === 'Revert') {
277+
if (choice == 'Undo') {
276278
// Restore to state and UI
277279
checkpoints.splice(
278280
real_index_in_state,

0 commit comments

Comments
 (0)