MCPcopy Create free account
hub / github.com/Effect-TS/effect / instance

Function instance

packages/effect/src/ui/internal/serialize.ts:92–131  ·  view source on GitHub ↗
(inst: Kernel.Instance)

Source from the content-addressed store, hash-verified

90 }
91 }
92 const instance = (inst: Kernel.Instance): void => {
93 const component = inst.component as unknown as Component.Any
94 const rendered = inst.rendered
95 const encoded = inst.failure === undefined && !deferred.has(inst)
96 ? runCodec(
97 Effect.provideService(
98 encodePage(
99 component,
100 inst.model,
101 inst.results,
102 inst.providing?.collected
103 ),
104 queryCore.Shipped,
105 shippedQuery
106 )
107 )
108 : undefined
109 if (encoded !== undefined && !Exit.isExit(encoded)) late.push(encoded)
110 tape.push(
111 Instance,
112 {
113 inst,
114 encoded,
115 status: component.layer === undefined ? undefined : statusOf(inst.env),
116 bare: inst.parent !== undefined && component.layer === undefined &&
117 (inst.at!.v as View.Child<any, any>).bound === undefined &&
118 rendered?.v._tag === "Element"
119 } satisfies InstanceSnap
120 )
121 const away = Kernel.unplaced(inst)
122 if (away.length === 0) todo.push(undefined, Done)
123 else {
124 todo.push(undefined, End)
125 for (let index = away.length - 1; index >= 0; index--) todo.push(away[index])
126 todo.push(undefined, Away)
127 }
128 if (inst.failure === undefined && rendered !== undefined) {
129 todo.push(inst, inst.path, rendered)
130 }
131 }
132 while (todo.length > 0) {
133 const at: Kernel.Rec | Kernel.Instance | number = todo.pop()
134 if (typeof at === "number") {

Callers 1

snapshotFunction · 0.70

Calls 5

runCodecFunction · 0.90
encodePageFunction · 0.90
statusOfFunction · 0.70
hasMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected