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

Function makeDeleteLinkCallback

client/src/mutations/deleteLinkMutation.ts:17–41  ·  view source on GitHub ↗
({ selectedRepoId, linkId }: {
  linkId: string,
  selectedRepoId: string | null,
})

Source from the content-addressed store, hash-verified

15`
16
17export function makeDeleteLinkCallback({ selectedRepoId, linkId }: {
18 linkId: string,
19 selectedRepoId: string | null,
20}) {
21 const deleteLink = useMutation<deleteLinkMutation>(query)[0]
22
23 const updater = (store: RecordSourceSelectorProxy) => {
24 store.delete(linkId)
25 }
26
27 return useCallback(() => {
28 if (!selectedRepoId) {
29 console.log('no repo selected')
30 return
31 }
32
33 deleteLink({
34 variables: {
35 input: { repoId: selectedRepoId, linkId },
36 },
37 optimisticUpdater: updater,
38 updater,
39 })
40 }, [deleteLink, selectedRepoId, linkId, updater])
41}

Callers 1

EditRepoLinkFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected