Async State Management without the Management
APACHE-2.0 License
Bot releases are visible (Hide)
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 6 months ago
#3023 9dea825
Thanks @renovate! - Compatibility with React 19 by removing defaultProps
Updated dependencies [dcb6b2f
]:
Published by github-actions[bot] 6 months ago
#3020 dcb6b2f
Thanks @ntucker! - Hooks arg-typechecking accuracy improved
For example string literals now work:
const getThing = new Endpoint(
(args: { postId: string | number; sortBy?: "votes" | "recent" }) =>
Promise.resolve({ a: 5, ...args }),
{ schema: MyEntity },
);
const myThing = useSuspense(getThing, {
postId: "5",
sortBy: "votes",
});
#3023 9dea825
Thanks @renovate! - Compatibility with React 19 by removing defaultProps
Updated dependencies [9dea825
, dcb6b2f
]:
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 6 months ago
#3023 9dea825
Thanks @renovate! - Compatibility with React 19 by removing defaultProps
Updated dependencies [dcb6b2f
]:
Published by github-actions[bot] 6 months ago
#3023 9dea825
Thanks @renovate! - Compatibility with React 19 by removing defaultProps
Updated dependencies [dcb6b2f
]:
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 6 months ago
#3020 dcb6b2f
Thanks @ntucker! - Add NI<> utility type that is back-compat NoInfer<>
Updated dependencies [dcb6b2f
]:
Published by github-actions[bot] 6 months ago
#3017 ce164d2
Thanks @ntucker! - Queries pass-through suspense rather than ever being undefined
INVALID
as undefined
returnUpdated dependencies [ce164d2
]:
Published by github-actions[bot] 6 months ago
#3017 ce164d2
Thanks @ntucker! - Queries pass-through suspense rather than ever being undefined
INVALID
as undefined
returnUpdated dependencies [ce164d2
]:
Published by github-actions[bot] 6 months ago
#3017 ce164d2
Thanks @ntucker! - Queries pass-through suspense rather than ever being undefined
INVALID
as undefined
returnPublished by github-actions[bot] 6 months ago
#3010 c906392
Thanks @ntucker! - ErrorBoundary listens to all errors
This means it may catch errors that were previously passing thorugh
#3010 c906392
Thanks @ntucker! - ErrorBoundary default error fallback supports react native
#3010 c906392
Thanks @ntucker! - Add listen prop to ErrorBoundary and AsyncBoundary
<AsyncBoundary listen={history.listen}>
<MatchedRoute index={0} />
</AsyncBoundary>
#3010 c906392
Thanks @ntucker! - Add resetErrorBoundary sent to errorComponent
function ErrorComponent({
error,
className,
resetErrorBoundary,
}: {
error: Error;
resetErrorBoundary: () => void;
className?: string;
}) {
return (
<pre role="alert" className={className}>
{error.message} <button onClick={resetErrorBoundary}>Reset</button>
</pre>
);
}
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 6 months ago
#3006 13c6466
Thanks @ntucker! - Endpoint.sideEffect can be false
Updated dependencies [13c6466
]:
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 7 months ago
Published by github-actions[bot] 7 months ago
Release notes and migration guide
#2921 6e55026
Thanks @ntucker! - BREAKING: new AbortOptimistic() -> snapshot.abort
getOptimisticResponse(snapshot, { id }) {
const { data } = snapshot.getResponse(Base.get, { id });
if (!data) throw new AbortOptimistic();
return {
id,
votes: data.votes + 1,
};
}
getOptimisticResponse(snapshot, { id }) {
const { data } = snapshot.getResponse(Base.get, { id });
if (!data) throw snapshot.abort;
return {
id,
votes: data.votes + 1,
};
}
#2921 6e55026
Thanks @ntucker! - BREAKING: new Query -> new schema.Query
const getUserCount = new Query(
new schema.All(User),
(entries, { isAdmin } = {}) => {
if (isAdmin !== undefined)
return entries.filter((user) => user.isAdmin === isAdmin).length;
return entries.length;
},
);
const userCount = useCache(getUserCount);
const adminCount = useCache(getUserCount, { isAdmin: true });
const getUserCount = new schema.Query(
new schema.All(User),
(entries, { isAdmin } = {}) => {
if (isAdmin !== undefined)
return entries.filter((user) => user.isAdmin === isAdmin).length;
return entries.length;
},
);
const userCount = useQuery(getUserCount);
const adminCount = useQuery(getUserCount, { isAdmin: true });
#2957 c129a25
Thanks @ntucker! - BREAKING CHANGE: Remove new AbortOptimistic() in favor of snapshot.abort
getOptimisticResponse(snapshot, { id }) {
const { data } = snapshot.getResponse(Base.get, { id });
if (!data) throw snapshot.abort;
return {
id,
votes: data.votes + 1,
};
}
#2972 bb24601
Thanks @ntucker! - BREAKING: Entity.useIncoming → Entity.shouldUpdate)
class MyEntity extends Entity {
// highlight-next-line
static useIncoming(
existingMeta: { date: number },
incomingMeta: { date: number },
existing: any,
incoming: any,
) {
return !deepEquals(existing, incoming);
}
}
class MyEntity extends Entity {
// highlight-next-line
static shouldUpdate(
existingMeta: { date: number },
incomingMeta: { date: number },
existing: any,
incoming: any,
) {
return !deepEquals(existing, incoming);
}
}
#2921 6e55026
Thanks @ntucker! - BREAKING: useCache(new Index(MyEntity)) -> useQuery(MyEntity)
const UserIndex = new Index(User);
const bob = useCache(UserIndex, { username: "bob" });
const bob = useQuery(User, { username: "bob" });
2e169b7
Thanks @ntucker! - Fix schema.All denormalize INVALID case should also work when class name mangling is performed in production builds
unvisit()
always returns undefined
with undefined
as input.All
returns INVALID from queryKey()
to invalidate what was previously a special case in unvisit()
(when there is no table entry for the given entity)#2962 f6f195d
Thanks @ntucker! - Improve .extend() typing when using loose null checks and no body parameter
8377e0a
Thanks @ntucker! - fix: Resource.getList.schema args types
#2961 446f0b9
Thanks @ntucker! - Allow pk() to return numbers
Before:
class MyEntity extends Entity {
id = 0;
pk() {
return `${this.id}`;
}
}
After:
class MyEntity extends Entity {
id = 0;
pk() {
return this.id;
}
}
Updated dependencies [2e169b7
, 6e55026
, 6e55026
, 73de27f
, 59a407a
, 8377e0a
, c129a25
, 6e55026
, 446f0b9
, bb24601
, 6e55026
, 446f0b9
, f68750f
]:
Published by github-actions[bot] 7 months ago