0.2.2 (#31)
All checks were successful
Lint / lint (push) Successful in 11s
Publish / publish (push) Successful in 18s

Co-authored-by: Julien Valverdé <julien.valverde@mailo.com>
Co-authored-by: Renovate Bot <renovate-bot@valverde.cloud>
Reviewed-on: #31
This commit was merged in pull request #31.
This commit is contained in:
2026-01-16 17:05:30 +01:00
parent 89f966d93e
commit 0e8adf8506
14 changed files with 656 additions and 461 deletions

View File

@@ -19,15 +19,15 @@
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"globals": "^16.5.0",
"globals": "^17.0.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"type-fest": "^5.2.0",
"vite": "^7.2.6"
},
"dependencies": {
"@effect/platform": "^0.93.6",
"@effect/platform-browser": "^0.73.0",
"@effect/platform": "^0.94.0",
"@effect/platform-browser": "^0.74.0",
"@radix-ui/themes": "^3.2.1",
"@typed/id": "^0.17.2",
"effect": "^3.19.8",

View File

@@ -20,8 +20,8 @@ export type TextFieldFormInputProps = Props | OptionalProps
export class TextFieldFormInput extends Component.makeUntraced("TextFieldFormInput")(function*(props: TextFieldFormInputProps) {
const input: (
| { readonly optional: true } & Form.useOptionalInput.Result<string>
| { readonly optional: false } & Form.useInput.Result<string>
| { readonly optional: true } & Form.useOptionalInput.Success<string>
| { readonly optional: false } & Form.useInput.Success<string>
) = props.optional
// biome-ignore lint/correctness/useHookAtTopLevel: "optional" reactivity not supported
? { optional: true, ...yield* Form.useOptionalInput(props.field, props) }

View File

@@ -18,16 +18,16 @@ const ResultView = Component.makeUntraced("Result")(function*() {
const [idRef, query, mutation] = yield* Component.useOnMount(() => Effect.gen(function*() {
const idRef = yield* SubscriptionRef.make(1)
const key = Stream.zipLatest(Stream.make("posts" as const), idRef.changes)
const query = yield* Query.service({
key,
key: Stream.zipLatest(Stream.make("posts" as const), idRef.changes),
f: ([, id]) => HttpClient.HttpClient.pipe(
Effect.tap(Effect.sleep("500 millis")),
Effect.andThen(client => client.get(`https://jsonplaceholder.typicode.com/posts/${ id }`)),
Effect.andThen(response => response.json),
Effect.andThen(Schema.decodeUnknown(Post)),
),
staleTime: "10 seconds",
})
const mutation = yield* Mutation.make({
@@ -74,7 +74,7 @@ const ResultView = Component.makeUntraced("Result")(function*() {
Match.tag("Success", result => <>
<Heading>{result.value.title}</Heading>
<Text>{result.value.body}</Text>
{Result.isRefreshing(result) && <Text>Refreshing...</Text>}
{Result.hasRefreshingFlag(result) && <Text>Refreshing...</Text>}
</>),
Match.tag("Failure", result =>
<Text>An error has occured: {result.cause.toString()}</Text>
@@ -85,7 +85,7 @@ const ResultView = Component.makeUntraced("Result")(function*() {
<Flex direction="row" justify="center" align="center" gap="1">
<Button onClick={() => runPromise(query.refresh)}>Refresh</Button>
<Button onClick={() => runPromise(query.refetch)}>Refetch</Button>
<Button onClick={() => runPromise(query.invalidateCache)}>Invalidate cache</Button>
</Flex>
<div>
@@ -94,7 +94,7 @@ const ResultView = Component.makeUntraced("Result")(function*() {
Match.tag("Success", result => <>
<Heading>{result.value.title}</Heading>
<Text>{result.value.body}</Text>
{Result.isRefreshing(result) && <Text>Refreshing...</Text>}
{Result.hasRefreshingFlag(result) && <Text>Refreshing...</Text>}
</>),
Match.tag("Failure", result =>
<Text>An error has occured: {result.cause.toString()}</Text>