Stop orphan game links from blocking global imports
A game link could outlive its toolbox when one tab linked a game while another tab, unaware of that link, deleted the toolbox. Auto-backups and manual exports then copied the orphan link, and the global import rejected the whole file. - Drop links to missing toolboxes inside the IndexedDB transaction. - Remove orphan links already stored when the page loads. - Ignore a link request to a toolbox that no longer exists. - Leave orphan links out of exports and skip them on global import, so older backups import again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
98c442a9cd
commit
d030c3f59f
9 changed files with 137 additions and 9 deletions
|
|
@ -244,6 +244,24 @@ test("failed toolbox deletion preserves registry links and modules together", as
|
|||
assert.deepEqual(queue.getCurrent(), initial);
|
||||
});
|
||||
|
||||
test("a game cannot be linked to a toolbox that no longer exists", async () => {
|
||||
let state = { toolboxes: [{ id: "kept", modules: [] }], links: { game: "kept" }, moduleData: {} };
|
||||
const actions = useToolboxActions({
|
||||
store: {
|
||||
ready: true,
|
||||
...state,
|
||||
persistToolboxSnapshot: async (apply) => {
|
||||
state = { ...state, ...apply(state) };
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
await actions.linkToolboxToGame("other", "deleted");
|
||||
assert.deepEqual(state.links, { game: "kept" });
|
||||
await actions.linkToolboxToGame("other", "kept");
|
||||
assert.deepEqual(state.links, { game: "kept", other: "kept" });
|
||||
});
|
||||
|
||||
test("storage mutations target independent records and preserve deferred media deletions", () => {
|
||||
const expected = {
|
||||
toolboxes: [{ id: "a", modules: [{ id: "media", type: "images" }] }],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue