MCPcopy Create free account
hub / github.com/massCodeIO/massCode / refreshSelectedSnippet

Function refreshSelectedSnippet

src/renderer/composables/useSnippets.ts:144–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142})
143
144async function refreshSelectedSnippet() {
145 const snippetId = state.snippetId
146 const requestToken = ++selectedSnippetRequestToken
147
148 if (snippetId === undefined) {
149 selectedSnippetRecord.value = undefined
150 return
151 }
152
153 try {
154 const { data } = await api.snippets.getSnippetsById(String(snippetId))
155
156 if (requestToken === selectedSnippetRequestToken) {
157 selectedSnippetRecord.value = data
158 }
159 }
160 catch (error) {
161 if (requestToken === selectedSnippetRequestToken) {
162 selectedSnippetRecord.value = undefined
163 }
164 console.error(error)
165 }
166}
167
168watch(
169 () => state.snippetId,

Callers 8

useSnippets.tsFile · 0.85
createSnippetContentFunction · 0.85
updateSnippetFunction · 0.85
updateSnippetsFunction · 0.85
deleteSnippetContentFunction · 0.85
addTagToSnippetFunction · 0.85
deleteTagFromSnippetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected