Skip to content

Commit 8a4592e

Browse files
committed
Delete pinned checkpoints when clearing all checkpoints
- clearing all checkpoints should remove pinned as well └── apps └── editor └── src ├── commands │ └── history-command │ ├── actions │ │ ├── clear-all-checkpoints.ts │ │ ├── create-temporary-checkpoint.ts │ │ ├── delete-checkpoint-with-undo.ts │ │ ├── restore-checkpoint.ts │ │ ├── toggle-checkpoint-pin.ts │ │ └── update-checkpoint-description.ts │ ├── history-command.ts │ └── index.ts └── features └── checkpoints ├── actions │ ├── accept-checkpoint.ts │ ├── create-checkpoint.ts │ ├── delete-checkpoint.ts │ ├── get-checkpoints.ts │ └── index.ts ├── types │ ├── checkpoint.ts │ └── index.ts └── utils ├── checkpoints-metadata.ts ├── get-checkpoint-path.ts ├── get-checkpoints-storage-key.ts ├── get-incremented-description.ts └── index.ts
1 parent d9b4f9b commit 8a4592e

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

‎apps/editor/src/commands/history-command/actions/clear-all-checkpoints.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@ export const clear_all_checkpoints = async (
1212
) => {
1313
const clear_task = async () => {
1414
const checkpoints = await get_checkpoints(extension_context)
15-
const checkpoints_to_keep: Checkpoint[] = []
1615

1716
for (const checkpoint of checkpoints) {
18-
if (checkpoint.is_pinned) {
19-
checkpoints_to_keep.push(checkpoint)
20-
continue
21-
}
2217
try {
2318
const checkpoint_path = get_checkpoint_path(
2419
checkpoint.timestamp,
@@ -60,7 +55,7 @@ export const clear_all_checkpoints = async (
6055
undefined
6156
)
6257

63-
await save_checkpoints_metadata(extension_context, checkpoints_to_keep)
58+
await save_checkpoints_metadata(extension_context, [])
6459
}
6560
await vscode.window.withProgress(
6661
{

‎apps/editor/src/commands/history-command/history-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export const history_command = (params: {
331331
params.extension_context.workspaceState.get<Checkpoint>(
332332
TEMPORARY_CHECKPOINT_STATE_KEY
333333
)
334-
if (!checkpoints.some((c) => !c.is_pinned) && !temp_checkpoint) {
334+
if (checkpoints.length === 0 && !temp_checkpoint) {
335335
vscode.window.showInformationMessage(
336336
t('command.history-command.info.nothing-to-delete')
337337
)

0 commit comments

Comments
 (0)