@@ -46,6 +46,6 @@
|
||||
"react": "^19.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"effect-lens": "^0.1.5"
|
||||
"effect-lens": "^0.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export class SynchronizedFormImpl<
|
||||
|
||||
this.value = Effect.succeed(this).pipe(
|
||||
Effect.map(self => Subscribable.make({
|
||||
get get() { return Effect.provide(Effect.option(self.target.get), self.context) },
|
||||
get: Effect.provide(Effect.option(self.target.get), self.context),
|
||||
get changes() {
|
||||
return Stream.provideContext(
|
||||
self.target.changes.pipe(
|
||||
@@ -74,22 +74,21 @@ export class SynchronizedFormImpl<
|
||||
})),
|
||||
Subscribable.unwrap,
|
||||
)
|
||||
this.encodedValue = Effect.succeed(this).pipe(
|
||||
Effect.map(self => Lens.make<I, TER, TEW, never, never>({
|
||||
get get() { return self.internalEncodedValue.get },
|
||||
get changes() { return self.internalEncodedValue.changes },
|
||||
modify: f => self.internalEncodedValue.modify(
|
||||
encodedValue => Effect.map(
|
||||
f(encodedValue),
|
||||
([b, nextEncodedValue]) => [
|
||||
[b, nextEncodedValue] as const,
|
||||
nextEncodedValue,
|
||||
] as const,
|
||||
)
|
||||
).pipe(
|
||||
Effect.tap(([, nextEncodedValue]) => self.synchronizeEncodedValue(nextEncodedValue)),
|
||||
Effect.map(([b]) => b),
|
||||
this.encodedValue = Effect.all([
|
||||
Effect.succeed(this),
|
||||
Effect.succeed(Lens.asLensImpl(this.internalEncodedValue)),
|
||||
]).pipe(
|
||||
Effect.map(([self, parent]) => Lens.make({
|
||||
get: parent.get,
|
||||
get changes() { return parent.changes },
|
||||
commit: a => Effect.andThen(
|
||||
Effect.flatMap(
|
||||
parent.resolve,
|
||||
resolved => resolved.commit(Effect.succeed(a)),
|
||||
),
|
||||
self.synchronizeEncodedValue(a),
|
||||
),
|
||||
lock: parent.lock,
|
||||
})),
|
||||
Lens.unwrap,
|
||||
)
|
||||
|
||||
@@ -13,17 +13,17 @@
|
||||
"clean:modules": "rm -rf node_modules"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tanstack/react-router": "^1.169.1",
|
||||
"@tanstack/react-router-devtools": "^1.166.13",
|
||||
"@tanstack/router-plugin": "^1.167.32",
|
||||
"@types/react": "^19.2.14",
|
||||
"@tanstack/react-router": "^1.170.10",
|
||||
"@tanstack/react-router-devtools": "^1.167.0",
|
||||
"@tanstack/router-plugin": "^1.168.13",
|
||||
"@types/react": "^19.2.15",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"@vitejs/plugin-react": "^6.0.2",
|
||||
"globals": "^17.6.0",
|
||||
"react": "^19.2.5",
|
||||
"react-dom": "^19.2.5",
|
||||
"type-fest": "^5.6.0",
|
||||
"vite": "^8.0.10"
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6",
|
||||
"type-fest": "^5.7.0",
|
||||
"vite": "^8.0.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform": "^0.96.1",
|
||||
@@ -35,8 +35,8 @@
|
||||
"react-icons": "^5.6.0"
|
||||
},
|
||||
"overrides": {
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react": "^19.2.15",
|
||||
"effect": "^3.21.2",
|
||||
"react": "^19.2.5"
|
||||
"react": "^19.2.6"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user