[ui] TwoTabs: The rose and the garden read again when another tab wrote, keeping their own

This commit is contained in:
2026-11-07 15:06:44 +01:00
parent 102ac44675
commit b67fa3603d
7 changed files with 185 additions and 9 deletions
+16
View File
@@ -72,6 +72,22 @@
return () => clearInterval(timer);
});
// A town chosen in another tab becomes the town here too (two-tabs.md).
$effect(() => {
const wiring = sunset;
return wiring?.changes?.(() => {
wiring.load().then(
(saved) => {
if (saved === null) return;
choice = saved;
status = 'set';
now = wiring.now();
},
(error: unknown) => console.error('sunset: could not read the town another tab chose', error)
);
});
});
async function choose(next: SunsetChoice): Promise<void> {
if (!sunset) return;
choice = next;