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

Function startOngoingFetch

packages/rxdb-db-collection/src/rxdb.ts:211–234  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209
210 let sub: Subscription
211 function startOngoingFetch() {
212 // Subscribe early and buffer live changes during initial load and ongoing
213 sub = rxCollection.$.subscribe((ev) => {
214 const cur: Row = stripRxdbFields(clone(ev.documentData as Row))
215 switch (ev.operation) {
216 case `INSERT`:
217 queue({ type: `insert`, value: cur })
218 break
219 case `UPDATE`:
220 queue({ type: `update`, value: cur })
221 break
222 case `DELETE`:
223 queue({ type: `delete`, value: cur })
224 break
225 }
226 })
227
228 const subs = getFromMapOrCreate(
229 OPEN_RXDB_SUBSCRIPTIONS,
230 rxCollection,
231 () => new Set(),
232 )
233 subs.add(sub)
234 }
235
236 async function start() {
237 startOngoingFetch()

Callers 1

startFunction · 0.85

Calls 4

stripRxdbFieldsFunction · 0.90
queueFunction · 0.85
subscribeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected