[ui] TwoTabs: The rose and the garden read again when another tab wrote, keeping their own
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user