MCPcopy Index your code
hub / github.com/TanStack/db / setStatus

Method setStatus

packages/db/src/collection/subscription.ts:269–293  ·  view source on GitHub ↗

* Set subscription status and emit events if changed

(newStatus: SubscriptionStatus)

Source from the content-addressed store, hash-verified

267 * Set subscription status and emit events if changed
268 */
269 private setStatus(newStatus: SubscriptionStatus) {
270 if (this._status === newStatus) {
271 return // No change
272 }
273
274 const previousStatus = this._status
275 this._status = newStatus
276
277 // Emit status:change event
278 this.emitInner(`status:change`, {
279 type: `status:change`,
280 subscription: this,
281 previousStatus,
282 status: newStatus,
283 })
284
285 // Emit specific status event
286 const eventKey: `status:${SubscriptionStatus}` = `status:${newStatus}`
287 this.emitInner(eventKey, {
288 type: eventKey,
289 subscription: this,
290 previousStatus,
291 status: newStatus,
292 } as SubscriptionEvents[typeof eventKey])
293 }
294
295 /**
296 * Track a loadSubset promise and manage loading status

Callers 4

startSyncMethod · 0.45
transitionToErrorMethod · 0.45

Calls 1

emitInnerMethod · 0.80

Tested by

no test coverage detected