Repository navigation
Release/0.1.0 rc.5 - #21
Merged
Merged
Conversation
- `useRefetch` with a key holding a query, family or group now throws `Query.KeyHoldsTargetError` as it renders, instead of doing nothing - Name `api.query`'s types (`EndpointQueryValue`, `EndpointQueryCallError`, `EndpointQueryOptionsFor`) in place of inline conditional types - Develop and test against `effect` 4.1.5 and update dev dependencies
- `QueryClient.make({ entities: { sync: [Todos] } })` writes each fetched copy
over older copies with the same id in other queries; the newest fetch wins
- A query opts out with `entities: { sync: false }` (`Query.EntitiesOptions`)
- Document entity sync, responses in other shapes and transforming schemas in
the README
- An infinite query's refetch or retry dates each page by its own attempt - Loading the next page sends only that page - A copy no attempt read (a live push during the fetch) counts as a write - Query.set/update and the sync's writes survive an id or listener that throws - chore: release 0.1.0-rc.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additive release: opt-in entity sync, two exported errors, named types for
api.query, and namespace docs in editor hovers. It works with@monarcode/effetch0.1.0-rc.4 and later in 0.1, as rc.4 does; the peerranges are unchanged. One fix can surface in your app:
useRefetchwith akey that holds a query now throws instead of doing nothing (see Fixed).
Added
Entity sync. Turn it on for the entities to keep in sync:
When a query's fetch succeeds, each copy of the entity in its value goes
over the older copies with the same id in every other query that holds
it. A details refetch updates the list rows, and a list fetch updates
the cached details, with no other fetch.
response doesn't overwrite a newer one, a retry counts from when it
started, and an infinite query's refetch dates each page by its own
request.
Entity.set,Query.set/update, alivepush) counts asnewer than every fetch in flight. It isn't spread to other queries:
an entity write already reached them, and an optimistic one may roll
back.
entities: { sync: false }(
Query.EntitiesOptions).idor a listener that throws is logged withEffect.logError.The fetch, and any
Query.setorQuery.update, keeps its value.See "Keep copies in sync" in the README for the full rules and the
cost. Known limit: when one id appears twice in a response (a row that
moved between pages during a refetch), the older duplicate isn't
corrected.
Query.KeyHoldsTargetErrorand, from@monarcode/effetch-query/effetch,EndpointQueryErrorare exported, so you can match them withinstanceofand name their types. Their tags and messages are unchanged.Named types for
api.query:EndpointQueryValue,EndpointQueryCallErrorandEndpointQueryOptionsFor. Go to Definitionand hovers read more simply; the types each call resolves to are
unchanged.
api.query,api.infiniteQueryandapi.mutationhaveexamples in their hovers.
New README sections:
response shape to an entity's schema.
whose schema can't encode its value is left out of
dehydratewithno error, and the browser fetches it again.
Fixed
useRefetchwith a key that holds a query, a family or a group, such asuseRefetch([todos, profile]), now throwsQuery.KeyHoldsTargetErroras it renders, as the README said it does. Before, its
refetchdidnothing and the error was lost. Pass a
Query.groupinstead.Changed
Entity,InfiniteQuery,Mutation,Query,QueryClient,Signals) show their docs instead of only themodule path. A member's hover reads
(alias) const Query.make: …. Go toDefinition on a namespace lands on
index.d.ts, and on a member itstill lands on the member's own declaration.
effect4.1.5 and@effect/atom-react4.1.5.