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

Function loadData

examples/react-native/offline-transactions/server/index.ts:32–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31// Load persisted data or seed with initial data
32function loadData() {
33 try {
34 const raw = readFileSync(DATA_FILE, 'utf-8')
35 const todos: Array<Todo> = JSON.parse(raw)
36 todos.forEach((todo) => todosStore.set(todo.id, todo))
37 console.log(`Loaded ${todos.length} todos from ${DATA_FILE}`)
38 } catch {
39 console.log(`No existing data file, starting empty`)
40 }
41}
42
43function saveData() {
44 writeFileSync(

Callers 1

index.tsFile · 0.85

Calls 2

forEachMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected