fix context menu issues with new plugins being loaded
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user