fix: seeder writes to localStorage before loadState, not after
Previous version modified BOARDS in-memory and called saveState() — timing caused cards to be lost on reload. New version writes directly to kanban_v2 in localStorage before loadState reads it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
14
index.html
14
index.html
@@ -2380,8 +2380,8 @@ if (window.location.protocol === 'file:') {
|
||||
}
|
||||
loadGroups();
|
||||
loadBoardOrder();
|
||||
loadState();
|
||||
seedCards();
|
||||
loadState();
|
||||
renderSidebar();
|
||||
loadIdeas();
|
||||
renderIdeas();
|
||||
@@ -2389,7 +2389,7 @@ show('doener');
|
||||
setView('overview');
|
||||
|
||||
// ── CARD SEEDER ──────────────────────────────────────────────────────────────
|
||||
const CARD_SEED_VERSION = '2026-05-20-a';
|
||||
const CARD_SEED_VERSION = '2026-05-20-b';
|
||||
function seedCards() {
|
||||
if (localStorage.getItem('kanban_cards_seeded') === CARD_SEED_VERSION) return;
|
||||
const batch = {
|
||||
@@ -2402,13 +2402,13 @@ function seedCards() {
|
||||
musichub: ['Status quo klären','Neues Sprint Goal definieren'],
|
||||
doener: ['App-Store-Launch als Sprint Goal definieren'],
|
||||
};
|
||||
const snap = JSON.parse(localStorage.getItem('kanban_v2') || '{}');
|
||||
Object.entries(batch).forEach(([id, tasks]) => {
|
||||
if (!BOARDS[id]) return;
|
||||
const ready = BOARDS[id].cols.find(c => c.id === 'ready');
|
||||
if (!ready) return;
|
||||
tasks.forEach(t => { if (!ready.tasks.find(c => c.t === t)) ready.tasks.push({t}); });
|
||||
if (!snap[id]) snap[id] = {cols:[{id:'ready',label:'Ready',tasks:[]},{id:'wip',label:'In Progress',tasks:[]},{id:'done',label:'Done',tasks:[]}],focus:''};
|
||||
const ready = (snap[id].cols || []).find(c => c.id === 'ready');
|
||||
if (ready) tasks.forEach(t => { if (!ready.tasks.find(c => c.t === t)) ready.tasks.push({t}); });
|
||||
});
|
||||
saveState();
|
||||
localStorage.setItem('kanban_v2', JSON.stringify(snap));
|
||||
localStorage.setItem('kanban_cards_seeded', CARD_SEED_VERSION);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user