From 4baf1e4960a88fda9e47fcfe171f253663060b91 Mon Sep 17 00:00:00 2001 From: "dionisio-bot[bot]" <117394943+dionisio-bot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 19:29:13 +0000 Subject: [PATCH] regression: Handle live setting forget user session on window close update (#33165) Co-authored-by: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> --- apps/meteor/client/startup/accounts.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/meteor/client/startup/accounts.ts b/apps/meteor/client/startup/accounts.ts index 60f2de02bde0..88008a606656 100644 --- a/apps/meteor/client/startup/accounts.ts +++ b/apps/meteor/client/startup/accounts.ts @@ -27,13 +27,15 @@ Accounts.onEmailVerificationLink((token: string) => { }); Meteor.startup(() => { - Tracker.autorun(() => { + Tracker.autorun((computation) => { const forgetUserSessionOnWindowClose = settings.get('Accounts_ForgetUserSessionOnWindowClose'); if (forgetUserSessionOnWindowClose === undefined) { return; } + computation.stop(); + Accounts.config({ clientStorage: forgetUserSessionOnWindowClose ? 'session' : 'local' }); }); });