MCPcopy Create free account
hub / github.com/anomalyco/opencode / start

Function start

packages/app/src/context/highlights.tsx:167–202  ·  view source on GitHub ↗
(previous: string)

Source from the content-addressed store, hash-verified

165 }
166
167 const start = (previous: string) => {
168 if (!settings.general.releaseNotes()) {
169 markSeen()
170 return
171 }
172
173 const fetcher = platform.fetch ?? fetch
174 const controller = new AbortController()
175 onCleanup(() => {
176 controller.abort()
177 clearTimer()
178 })
179
180 fetcher(CHANGELOG_URL, {
181 signal: controller.signal,
182 headers: { Accept: "application/json" },
183 })
184 .then((response) => (response.ok ? (response.json() as Promise<unknown>) : undefined))
185 .then((json) => {
186 if (!json) return
187 const highlights = loadReleaseHighlights(json, platform.version, previous)
188 if (controller.signal.aborted) return
189
190 if (highlights.length === 0) {
191 markSeen()
192 return
193 }
194
195 timer = setTimeout(() => {
196 timer = undefined
197 markSeen()
198 dialog.show(() => <DialogReleaseNotes highlights={highlights} />)
199 }, 500)
200 })
201 .catch(() => undefined)
202 }
203
204 createEffect(() => {
205 if (state.started) return

Callers 1

highlights.tsxFile · 0.70

Calls 5

markSeenFunction · 0.85
clearTimerFunction · 0.85
loadReleaseHighlightsFunction · 0.85
jsonMethod · 0.65
abortMethod · 0.45

Tested by

no test coverage detected