Releases: klis87/normy
@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.
@normy/react-query v0.8.0
Renamed getNormalisationObjectKey
option into getNormalizationObjectKey
.
@normy/core v0.7.0
Renamed getNormalisationObjectKey
option into getNormalizationObjectKey
.
@normy/react-query v0.7.0
-
refactored
createNormalizedQueryClient
intocreateQueryNormalizer
- it is not only about the name, but mostlycreateQueryNormalizer
does not createreact-query
client for you, you need to do it yourself and pass instance tocreateQueryNormalizer
, for example:const queryClient = new QueryClient(); createQueryNormalizer(queryClient);
-
added possibility to clear normalized data and unsubscribe from future updates, for example:
const normalizer = createQueryNormalizer(queryClient); normalizer.clear();
@normy/core v0.6.0
Added clearNormalized
, so it is possible now to clear all normalized data. You can use it like this:
const normalizer = createNormalizer(normalizerConfig);
normalizer.clearNormalizedData();