Skip to content

Mundus v0.7.95

Pre-release
Pre-release

Choose a tag to compare

@NotBedd NotBedd released this 20 Oct 13:07
· 69 commits to main since this release

Mundus v0.7.95 — Bug-Hunt & Hygiene Release

Fixes (8)

1. Deleting a character left their raw id displayed as a relative (the reported bug)

src/utils/characterRelativesSync.ts, src/App.tsx

  • Deleting a character (e.g. one of two partners) only filtered + tombstoned them; their id stayed inside every survivor's relatives (father/mother strings, siblings/partners/children arrays). Cards and the mention drawer then printed the id verbatim — "a number shown as partner".
  • New pure helper purgeDeletedCharacterReferences(survivors, deletedId, deletedName?) removes: (1) every ref equal to the deleted id, (2) opportunistically, any id-shaped (char-<digits>) ref that resolves to nobody — legacy dangling cleanup, (3) a ref equal to the deleted character's name only when no survivor owns that name (same-named survivors keep name refs meaningful).
  • handleDeleteCharacter now runs the purge, and cloud-saves each changed survivor (queueCharacterCloudSave) so the cleanup propagates. Local persistence happens via the existing debounced roster write.

2. CharacterCardDrawer printed raw relative ids (+ missing Siblings row)

src/components/characters/CharacterCardDrawer.tsx

  • The drawer (opened by clicking a character mention in the editor) rendered relatives raw — even existing character ids showed as char-1729…. It now resolves ids → names (same rule as the cards: id match, else case-insensitive name match, else shows a hand-typed custom name as-is).
  • Id-shaped refs resolving to nobody are hidden entirely (they can never be custom names), so pre-existing dangling data disappears from view without any risky migration.
  • The "Family & Lineage" box checked siblings in its header condition but never rendered a Siblings row — added.

3. CharactersMode cards hid nothing for dangling refs

src/components/characters/CharactersMode.tsx

  • Card relative rows + hasRelatives now use the same dangling-ref filter, so a card whose relatives are all dangling no longer shows an empty "Relatives" box with raw ids.

4. Local auto-snapshots couldn't restore Worlds

src/lib/backupEngine.ts, src/App.tsx

  • saveAutoBackupSnapshot omitted projects — the exact flaw v0.7.94 fixed for manual app-wide backups. Restoring a snapshot on a fresh/broken install left every document invisible (editor filters strictly by mundusId).
  • Snapshots now carry the world list; handleRestoreBackupSnapshot restores it with the same replace semantics + active-world validation ("mundus-prima" always valid, else newest restored world) as the manual path. All 3 snapshot call sites pass projects: mundusProjects.

5. Deleted worlds'/documents' content resurrected from the cloud (Firebase users)

src/App.tsx

  • handleDeleteDocument cleaned story links locally but never pushed them: the startup merge replaces the local link list from Firestore, so the deleted doc's links came back next launch. → now calls scheduleLoreCloudSave().
  • handleDeleteMundusProject cleaned local docs/folders/characters/entries/events/links but deleted only the project record in the cloud. Startup merge replaces local documents/folders from cloud and merges entries/characters back → the deleted world's content resurrected (docs/folders immediately; entries on merge; characters once the 7-day tombstone TTL pruned). Now cloud-deletes every scoped document, folder, codex entry and character (deleteUserDocument/Folder/CodexEntry/Character, fire-and-forget with catch) and pushes the cleaned events/links via scheduleLoreCloudSave().

6. Deleting a world orphaned its map data forever

src/App.tsx

  • mundus_map_markers_<id> / mundus_map_world_name_<id> in localStorage and the full-resolution map image in IndexedDB (32MB+ possible) were never removed on world deletion. Now removed (incl. deleteLocalMapImage).

7. Quota fallback freed nothing (wrong storage key)

src/App.tsx, src/lib/backupEngine.ts

  • The codex-entries quota fallback removed 'mundus_auto_backups' — a key that never exists (real key: 'mundus_local_auto_backups'), so the retry never freed space and entries still failed to save. AUTO_BACKUP_STORAGE_KEY is now exported and used everywhere (also fixes the phantom second key in persistCharactersMerged and hardcodes in handleClearSnapshots).

8. Unbalanced visibilitychange listener

src/App.tsx

  • The pagehide-flush effect registered visibilitychange inline and never removed it (the only add-without-remove in the file). Now a named handler removed in cleanup.

Files changed

  • src/App.tsx — fixes 1,4,5,6,7,8
  • src/utils/characterRelativesSync.ts — purge helper + looksLikeCharacterId (fix 1)
  • src/components/characters/CharacterCardDrawer.tsx — fix 2
  • src/components/characters/CharactersMode.tsx — fix 3
  • src/lib/backupEngine.ts — fix 4,7
  • scripts/test_relative_purge.ts — new suite (29 tests)
  • Version 0.7.95 / versionCode 788: package.json, package-lock.json (2), src/constants.ts, index.html (title+og), electron/main.ts, android/app/build.gradle