Files
LEDMatrix/web_interface/static/v3/js/plugins/state_manager.js
T
ChuckandClaude Opus 5.5 0e9e2cabba fix(web): widget cache-busting, dead frontend code, and dependency pins (#656)
- Plugin-supplied widgets load as /static/plugin-widgets/...js?v=<plugin
  version>, so an update isn't hidden behind the year-long immutable cache.
- Fire-and-forget loadInstalledPlugins() calls catch the rejection it has
  already reported, so the global handler no longer adds a second toast.
- Timezone picker renders again when the General partial is re-injected.
- Remove dead code: executePluginAction's six plugin-id fallbacks and
  [DEBUG] logging, window.currentPluginConfig and every read of it, the
  file-upload JSON delete branch, unused PluginAPI / PluginInstallManager /
  PluginStateManager helpers, loadPluginWidgetsFromManifest, the stale
  install_manager.js and LEDVisibility fallbacks, error_handler.js's global
  escapeHtml, 13 unused CSS rules, and stale comments/no-op returns.
- pytz < 2027, psutil < 7 in requirements-test.txt, pytest-cov < 8.
- Pin anthropics/claude-code-action to the commit v1 resolves to.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:40:52 -04:00

40 lines
1009 B
JavaScript

/**
* Frontend plugin state management.
*
* Manages local state for installed plugins and provides state synchronization.
*/
const PluginStateManager = {
/**
* Installed plugins state.
*/
installedPlugins: [],
/**
* Load installed plugins.
*
* @returns {Promise<Array>} List of installed plugins
*/
async loadInstalledPlugins() {
try {
const plugins = await window.PluginAPI.getInstalledPlugins();
this.installedPlugins = plugins;
window.installedPlugins = plugins; // For backward compatibility
return plugins;
} catch (error) {
if (window.errorHandler) {
window.errorHandler.displayError(error, 'Failed to load installed plugins');
}
throw error;
}
}
};
// Export
if (typeof module !== 'undefined' && module.exports) {
module.exports = PluginStateManager;
} else {
window.PluginStateManager = PluginStateManager;
}