Skip to content

Commit

Permalink
feat(core) добавил возможность ручной очистки состояния блока (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksey Chepurko <[email protected]>
  • Loading branch information
AlekseyChepurko and Aleksey Chepurko authored Nov 24, 2023
1 parent a4505a6 commit a9e8a15
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/storage/current/currentState.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ export class CurrentStateStorage {
CurrentStateStorage.data.blocks = CurrentStateStorage.data.blocks.filter((block) => block.id !== blockId);
};

/** Очищает информацию об элементах внутри блока */
static cleanUpBlockById = (blockId: ID) => {
const targetBlock = CurrentStateStorage.data.blocks.find((block) => block.id === blockId);
if (targetBlock) {
targetBlock.items = [];
}
};

/**
* Добавляет информацию в CurrentStateStorage.data.block[blockId] об элементе.
* Если в блоке уже существует такой элемент, дважды элемент добавлен не будет
Expand Down

0 comments on commit a9e8a15

Please sign in to comment.