Releases: klis87/normy
@normy/core v0.9.0
Added performance improvement for mutations. Now, after data is received in your mutation, each object in data will be compared with normalized data you already have in your store. If it is the same, then your queries dependent on a given object will not be updated.
It is a big performance improvement, because this check is super quick, while updating a very big query/queries is slower, and it does not make sense to do it if data is the same, as updated queries would remain the same anyway.
@normy/react-query v0.12.0
Added getObjectById
and getQueryFragment
functions. You can use getObjectById
to get an object from normalized store by id. With getQueryFragment
you can get multiple objects by id.
See https://github.com/klis87/normy/tree/master/packages/normy-react-query#getobjectbyid-and-getqueryfragment-arrow_up for potential usage.
@normy/core v0.8.0
Added getObjectById
and getQueryFragment
functions. You can use getObjectById
to get an object from normalized store by id. With getQueryFragment
you can get multiple objects by id.
See https://github.com/klis87/normy/tree/master/packages/normy-react-query#getobjectbyid-and-getqueryfragment-arrow_up for potential usage.
@normy/react-query v0.11.2
This is the same as 0.11.1
- released to fix latest
issues with npm.
@normy/react-query v0.11.1
Updated @normy/core
to 0.7.2 to fix issues with Date
objects.
@normy/react-query v0.10.1
Updated @normy/core
to 0.7.2 to fix Date
support.
@normy/core v0.7.2
Fix missing Date
support, now your data can have Date
objects and normalization will work fine. Thanks @garrettg123 for creating the issue.
@normy/react-query v0.11.0
Updated to work with react-query: 5
. This also works with work in progress trpc: 11
, for example with 11.0.0-next.92
.
There are no breaking changes with this release, however note, that if you still use react-query: 4
, you must use @normy/react-query v0.10.0
!
@normy/react-query v0.10.0
Until this time, the only way your data could be updated was as a reaction to API response. Now, there is a way to update the data manually. One of the best use case for this is reacting to a websocket notification that a given object was updated. You can use it as below:
import { useQueryNormalizer } from '@normy/react-query';
const SomeComponent = () => {
const queryNormalizer = useQueryNormalizer();
return (
<button
onClick={() =>
queryNormalizer.setNormalizedData({ id: '1', name: 'Updated name' })
}
>
Update user
</button>
);
};
@normy/react-query v0.9.0
Added a new way to initialize normalized store. Now you do this with QueryNormalizerProvider
, for example:
<QueryNormalizerProvider
queryClient={queryClient}
normalizerConfig={{ devLogging: true }}
>
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</QueryNormalizerProvider>
The new way has the advantage that normalized store is cleared automatically after QueryNormalizerProvider
is unmounted.
Another advantage is that next release will get a new normalized method to update data, for which new context reader to get normalized store instance anywhere will become handy.