MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / remove

Function remove

src/sidebarApps/index.js:52–68  ·  view source on GitHub ↗

* Removes a sidebar app with the given ID. * @param {string} id - The ID of the sidebar app to remove. * @returns {void}

(id)

Source from the content-addressed store, hash-verified

50 * @returns {void}
51 */
52function remove(id) {
53 const app = apps.find((app) => app.id === id);
54 if (!app) return;
55 const wasActive = app.active;
56 app.remove();
57 apps.splice(apps.indexOf(app), 1);
58 if (wasActive && apps.length > 0) {
59 const preferredApp = apps.find((app) => app.id === currentSection);
60 setActiveApp(preferredApp?.id || apps[0].id);
61 return;
62 }
63
64 if (!apps.length) {
65 currentSection = null;
66 localStorage.removeItem(SIDEBAR_APPS_LAST_SECTION);
67 }
68}
69
70/**
71 * Initialize sidebar apps

Callers

nothing calls this directly

Calls 2

setActiveAppFunction · 0.85
removeMethod · 0.45

Tested by

no test coverage detected