familytree

A self-hosted family tree builder.
Log | Files | Refs | README

commit 345ea6317369fff896e757d675d346073423cf03
parent 1c0a3b1b853e90caec16ff3bea24ac9bf88d1017
Author: Julian Piribauer <julian.piribauer@gmail.com>
Date:   Sun,  3 May 2026 07:19:46 +0000

Persist active tree across page loads via localStorage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Diffstat:
Mstatic/app.js | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/static/app.js b/static/app.js @@ -60,6 +60,10 @@ async function loadTrees() { const still = state.trees.find(t => t.id === state.activeTreeId); if (still) await loadGraph(state.activeTreeId); else selectTree(null); + } else if (state.trees.length) { + const saved = parseInt(localStorage.getItem('activeTreeId')); + const match = saved && state.trees.find(t => t.id === saved); + if (match) await selectTree(match.id); } } @@ -90,6 +94,8 @@ function renderSidebar() { async function selectTree(id) { state.activeTreeId = id; + if (id) localStorage.setItem('activeTreeId', id); + else localStorage.removeItem('activeTreeId'); closeDetailPanel(); renderSidebar(); if (!id) { showEmptyState(); return; }