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();
|
loadGroups();
|
||||||
loadBoardOrder();
|
loadBoardOrder();
|
||||||
loadState();
|
|
||||||
seedCards();
|
seedCards();
|
||||||
|
loadState();
|
||||||
renderSidebar();
|
renderSidebar();
|
||||||
loadIdeas();
|
loadIdeas();
|
||||||
renderIdeas();
|
renderIdeas();
|
||||||
@@ -2389,7 +2389,7 @@ show('doener');
|
|||||||
setView('overview');
|
setView('overview');
|
||||||
|
|
||||||
// ── CARD SEEDER ──────────────────────────────────────────────────────────────
|
// ── CARD SEEDER ──────────────────────────────────────────────────────────────
|
||||||
const CARD_SEED_VERSION = '2026-05-20-a';
|
const CARD_SEED_VERSION = '2026-05-20-b';
|
||||||
function seedCards() {
|
function seedCards() {
|
||||||
if (localStorage.getItem('kanban_cards_seeded') === CARD_SEED_VERSION) return;
|
if (localStorage.getItem('kanban_cards_seeded') === CARD_SEED_VERSION) return;
|
||||||
const batch = {
|
const batch = {
|
||||||
@@ -2402,13 +2402,13 @@ function seedCards() {
|
|||||||
musichub: ['Status quo klären','Neues Sprint Goal definieren'],
|
musichub: ['Status quo klären','Neues Sprint Goal definieren'],
|
||||||
doener: ['App-Store-Launch als 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]) => {
|
Object.entries(batch).forEach(([id, tasks]) => {
|
||||||
if (!BOARDS[id]) return;
|
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 = BOARDS[id].cols.find(c => c.id === 'ready');
|
const ready = (snap[id].cols || []).find(c => c.id === 'ready');
|
||||||
if (!ready) return;
|
if (ready) tasks.forEach(t => { if (!ready.tasks.find(c => c.t === t)) ready.tasks.push({t}); });
|
||||||
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);
|
localStorage.setItem('kanban_cards_seeded', CARD_SEED_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user