From f577476c8160ee9015f0a72765607312fb454a14 Mon Sep 17 00:00:00 2001 From: henrygd Date: Wed, 16 Jul 2025 14:39:15 -0400 Subject: [PATCH] clear systems from memory on logout (#970) --- beszel/site/src/lib/utils.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/beszel/site/src/lib/utils.ts b/beszel/site/src/lib/utils.ts index cf19457..6f61358 100644 --- a/beszel/site/src/lib/utils.ts +++ b/beszel/site/src/lib/utils.ts @@ -3,7 +3,15 @@ import { toast } from "@/components/ui/use-toast" import { type ClassValue, clsx } from "clsx" import { twMerge } from "tailwind-merge" import { $alerts, $copyContent, $systems, $userSettings, pb } from "./stores" -import { AlertInfo, AlertRecord, ChartTimeData, ChartTimes, FingerprintRecord, SystemRecord } from "@/types" +import { + AlertInfo, + AlertRecord, + ChartTimeData, + ChartTimes, + FingerprintRecord, + SystemRecord, + UserSettings, +} from "@/types" import { RecordModel, RecordSubscription } from "pocketbase" import { WritableAtom } from "nanostores" import { timeDay, timeHour } from "d3-time" @@ -74,7 +82,10 @@ export const updateSystemList = (() => { /** Logs the user out by clearing the auth store and unsubscribing from realtime updates. */ export async function logOut() { - sessionStorage.setItem("lo", "t") + $systems.set([]) + $alerts.set([]) + $userSettings.set({} as UserSettings) + sessionStorage.setItem("lo", "t") // prevent auto login on logout pb.authStore.clear() pb.realtime.unsubscribe() }