Skip to content

Commit

Permalink
fxd
Browse files Browse the repository at this point in the history
  • Loading branch information
alexy-os committed Dec 3, 2024
1 parent 778868e commit 7301b12
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions public/buildy/js/favourites-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
}
},

// Добавляем метод для очистки текущего состояния
clearCurrentState() {
// Обновляем метод очистки, сохраняя остальные объекты
clearCurrentStateBlocks() {
try {
localStorage.setItem(CURRENT_STATE_KEY, JSON.stringify({ blocks: {} }));
console.log('Current state cleared');
const currentState = this.getCurrentState();
// Сохраняем текущее состояние, но очищаем blocks
currentState.blocks = {};
localStorage.setItem(CURRENT_STATE_KEY, JSON.stringify(currentState));
console.log('Current state blocks cleared');
} catch (e) {
console.error('Error clearing current state:', e);
console.error('Error clearing current state blocks:', e);
}
}
};
Expand Down Expand Up @@ -82,8 +85,8 @@
async function processBlocks() {
const favourites = storage.getFavourites();

// Очищаем текущее состояние перед обработкой
storage.clearCurrentState();
// Очищаем только blocks в текущем состоянии
storage.clearCurrentStateBlocks();
const currentState = storage.getCurrentState();

for (const item of favourites) {
Expand Down

0 comments on commit 7301b12

Please sign in to comment.