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

Function setConfigValue

examples/solid/todo/src/components/TodoApp.tsx:29–47  ·  view source on GitHub ↗
(key: string, value: string)

Source from the content-addressed store, hash-verified

27
28 // Define a helper function to update config values
29 const setConfigValue = (key: string, value: string): void => {
30 for (const config of props.configData) {
31 if (config.key === key) {
32 props.configCollection.update(config.id, (draft) => {
33 draft.value = value
34 })
35 return
36 }
37 }
38
39 // If the config doesn't exist yet, create it
40 props.configCollection.insert({
41 id: Math.round(Math.random() * 1000000),
42 key,
43 value,
44 created_at: new Date(),
45 updated_at: new Date(),
46 })
47 }
48
49 const backgroundColor = getConfigValue(`backgroundColor`)
50

Callers 1

handleColorChangeFunction · 0.70

Calls 2

updateMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected