MCPcopy Index your code
hub / github.com/anomalyco/opencode / batch

Function batch

packages/core/src/state.ts:33–42  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

31})
32
33export function batch<A, E, R>(effect: Effect.Effect<A, E, R>) {
34 return Effect.gen(function* () {
35 const current = yield* CurrentBatch
36 if (current) return yield* effect
37 const reloads = new Set<Reload>()
38 const result = yield* effect.pipe(Effect.provideService(CurrentBatch, reloads))
39 yield* Effect.forEach(reloads, (reload) => reload(), { discard: true })
40 return result
41 })
42}
43
44export interface Options<State, DraftApi> {
45 /** Creates the base value for initial state and every scoped-transform reload. */

Callers 15

AppFunction · 0.85
SessionFunction · 0.85
sync.tsxFile · 0.85
bootstrapFunction · 0.85
syncFunction · 0.85
syncWorkspaceFunction · 0.85
flushFunction · 0.85
moveFunction · 0.85
setFunction · 0.85
toggleFavoriteFunction · 0.85
pruneFunction · 0.85
togglePinFunction · 0.85

Calls 1

reloadFunction · 0.70

Tested by

no test coverage detected