MCPcopy Create free account
hub / github.com/TanStack/db / cleanup

Method cleanup

packages/db/src/collection/sync.ts:511–532  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

509 }
510
511 public cleanup(): void {
512 try {
513 if (this.syncCleanupFn) {
514 this.syncCleanupFn()
515 this.syncCleanupFn = null
516 }
517 } catch (error) {
518 // Re-throw in a microtask to surface the error after cleanup completes
519 queueMicrotask(() => {
520 if (error instanceof Error) {
521 // Preserve the original error and stack trace
522 const wrappedError = new SyncCleanupError(this.id, error)
523 wrappedError.cause = error
524 wrappedError.stack = error.stack
525 throw wrappedError
526 } else {
527 throw new SyncCleanupError(this.id, error as Error | string)
528 }
529 })
530 }
531 this.preloadPromise = null
532 }
533}
534
535function normalizeSyncFnResult(result: void | CleanupFn | SyncConfigRes) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected