MCPcopy Create free account
hub / github.com/emwalker/digraph / makeOptimisticUpdater

Function makeOptimisticUpdater

client/src/mutations/upsertTopicMutation.ts:33–50  ·  view source on GitHub ↗
(parentTopicId: string, displayName: string)

Source from the content-addressed store, hash-verified

31let tmpId = 0
32
33function makeOptimisticUpdater(parentTopicId: string, displayName: string) {
34 return (store: RecordSourceSelectorProxy) => {
35 tmpId += 1
36 const id = `client:topic:${tmpId}`
37 const node = store.create(id, 'Topic')
38
39 node.setValue(id, 'id')
40 node.setValue(displayName, 'displayName')
41 node.setValue(true, 'loading')
42 node.setValue(null, 'repoTopics')
43 node.setValue(false, 'showRepoOwnership')
44
45 const topicEdge = store.create(`client:newEdge:${tmpId}`, 'TopicChildEdge')
46 topicEdge.setLinkedRecord(node, 'node')
47
48 return insertEdge(parentTopicId, store, topicEdge)
49 }
50}
51
52function makeUpdater(parentTopicId: string) {
53 return (store: RecordSourceSelectorProxy) => {

Callers 1

makeUpsertTopicFunction · 0.85

Calls 1

insertEdgeFunction · 0.85

Tested by

no test coverage detected