fix context menu issues with new plugins being loaded

This commit is contained in:
KingKDot
2026-07-01 09:31:51 -05:00
parent 01ecab779e
commit e0394ea1fa
2 changed files with 32 additions and 0 deletions
+15
View File
@@ -139,6 +139,7 @@ const clearContext = () => {
let _pluginCache = null;
let _pluginCacheAge = 0;
const PLUGIN_CACHE_TTL = 30_000;
const PLUGIN_CACHE_INVALIDATION_KEY = "overlord_plugin_cache_invalidated_at";
const pluginDashboardBadges = new Map();
let pluginDashboardDigest = "";
let pluginDashboardRefreshInFlight = false;
@@ -153,6 +154,11 @@ async function refreshPluginCache() {
} catch {}
}
function invalidatePluginCache() {
_pluginCache = null;
_pluginCacheAge = 0;
}
function getCachedPlugins() {
if (_pluginCache && Date.now() - _pluginCacheAge < PLUGIN_CACHE_TTL) {
return _pluginCache;
@@ -935,6 +941,15 @@ async function loadPluginsForClient(clientId) {
}
}
window.addEventListener("storage", (event) => {
if (event.key !== PLUGIN_CACHE_INVALIDATION_KEY) return;
invalidatePluginCache();
});
window.addEventListener("overlord:plugins-changed", () => {
invalidatePluginCache();
});
const PREF_LAYOUT_KEY = "overlord_layout";
let rendererSetLayout = null;