From 5ceeaf8a695e868eb6bb0bbbcc9aabe76e462279 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Tue, 31 Mar 2026 20:10:19 -0400 Subject: [PATCH] feat: share watch queue across tabs via localStorage + storage events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Queue was sessionStorage (per-tab only). Switch to localStorage so any tab can add to our shared queue. Storage events fire in all other same-origin tabs on mutation — renderQueue() wired to keep UI in sync automatically. --- make_post_sell/static/js/watch.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/make_post_sell/static/js/watch.js b/make_post_sell/static/js/watch.js index 0c195a9..23052c6 100644 --- a/make_post_sell/static/js/watch.js +++ b/make_post_sell/static/js/watch.js @@ -205,12 +205,20 @@ }); } - // Restore queue from sessionStorage + // Restore queue from localStorage (shared across tabs) try { - var savedQueue = sessionStorage.getItem('watchQueue'); + var savedQueue = localStorage.getItem('watchQueue'); if (savedQueue) queue = JSON.parse(savedQueue); } catch (e) {} + // Sync queue from other tabs via storage events + window.addEventListener('storage', function(e) { + if (e.key === 'watchQueue') { + try { queue = e.newValue ? JSON.parse(e.newValue) : []; } catch (ex) {} + renderQueue(); + } + }); + // Mod status (shop owner/editor) var isMod = false; @@ -424,7 +432,7 @@ // --- Queue management --- function saveQueue() { try { - sessionStorage.setItem('watchQueue', JSON.stringify(queue)); + localStorage.setItem('watchQueue', JSON.stringify(queue)); } catch (e) {} }