MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / removeMod

Function removeMod

apps/webuiapps/src/lib/modManager.ts:302–312  ·  view source on GitHub ↗
(collection: ModCollection, id: string)

Source from the content-addressed store, hash-verified

300}
301
302export function removeMod(collection: ModCollection, id: string): ModCollection {
303 const items = { ...collection.items };
304 delete items[id];
305 const activeId =
306 collection.activeId === id ? (Object.keys(items)[0] ?? DEFAULT_MOD_ID) : collection.activeId;
307 if (Object.keys(items).length === 0) {
308 items[DEFAULT_MOD_ID] = { config: DEFAULT_MOD, state: defaultState(DEFAULT_MOD) };
309 return { activeId: DEFAULT_MOD_ID, items };
310 }
311 return { activeId, items };
312}
313
314export function setActiveMod(collection: ModCollection, id: string): ModCollection {
315 if (!collection.items[id]) return collection;

Callers

nothing calls this directly

Calls 1

defaultStateFunction · 0.85

Tested by

no test coverage detected