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

Method getRowOrigin

packages/db/src/collection/state.ts:172–182  ·  view source on GitHub ↗

* Gets the origin of the last confirmed change to a row. * Returns 'local' if the row has optimistic mutations (optimistic changes are local). * Used to compute the $origin virtual property.

(key: TKey)

Source from the content-addressed store, hash-verified

170 * Used to compute the $origin virtual property.
171 */
172 public getRowOrigin(key: TKey): VirtualOrigin {
173 if (this.isLocalOnly) {
174 return 'local'
175 }
176 // If there are optimistic changes, they're local
177 if (this.optimisticUpserts.has(key) || this.optimisticDeletes.has(key)) {
178 return 'local'
179 }
180 // Otherwise, return the confirmed origin (defaults to 'remote' for synced data)
181 return this.rowOrigins.get(key) ?? 'remote'
182 }
183
184 private createVirtualPropsSnapshot(
185 key: TKey,

Callers 1

Calls 2

hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected