MCPcopy Index your code
hub / github.com/anomalyco/opencode / removePersisted

Function removePersisted

packages/app/src/utils/persist.ts:528–551  ·  view source on GitHub ↗
(
  target: { storage?: string; legacyStorageNames?: string[]; key: string },
  platform?: Platform,
)

Source from the content-addressed store, hash-verified

526}
527
528export function removePersisted(
529 target: { storage?: string; legacyStorageNames?: string[]; key: string },
530 platform?: Platform,
531) {
532 const isDesktop = platform?.platform === "desktop" && !!platform.storage
533
534 if (isDesktop) {
535 void platform.storage?.(target.storage)?.removeItem(target.key)
536 for (const storage of target.legacyStorageNames ?? []) {
537 void platform.storage?.(storage)?.removeItem(target.key)
538 }
539 return
540 }
541
542 if (!target.storage) {
543 localStorageDirect().removeItem(target.key)
544 return
545 }
546
547 localStorageWithPrefix(target.storage).removeItem(target.key)
548 for (const storage of target.legacyStorageNames ?? []) {
549 localStorageWithPrefix(storage).removeItem(target.key)
550 }
551}
552
553export function persisted<T>(
554 target: string | PersistTarget,

Callers 4

removeDraftPersistedFunction · 0.90
dropSessionStateFunction · 0.90
clearWorkspaceTerminalsFunction · 0.90
persist.test.tsFile · 0.85

Calls 3

localStorageDirectFunction · 0.85
localStorageWithPrefixFunction · 0.85
removeItemMethod · 0.80

Tested by

no test coverage detected