normy

Automatic normalization and data updates for data fetching libraries (react-query, swr, rtk-query and more)

MIT License

Downloads
5.4K
Stars
257
Committers
3

Bot releases are visible (Hide)

normy - @normy/core v0.10.1 Latest Release

Published by klis87 3 months ago

Updated deep merging library dependency. Thanks @haddowg for the contribution!

normy - @normy/rtk-query v0.1.3

Published by klis87 8 months ago

Updated core to the newest version.

normy - @normy/swr v0.1.2

Published by klis87 8 months ago

Update to newest @normy/core to get new structuralSharing feature.

normy - @normy/react-query v0.14.2

Published by klis87 8 months ago

Update to newest @normy/core to get new structuralSharing feature.

normy - @normy/core v0.10.0

Published by klis87 8 months ago

Added structuralSharing option, which is true by default. It is a big performance improvenent for libraries which use structural sharing - preserving data reference for the same structure. For such cases, normy will not normalize data, as it would not update normalized store anyway.

normy - @normy/rtk-query v0.1.0

Published by klis87 9 months ago

This is the first release of the new rtk-query integration. Please check its documentation.

normy - @normy/swr v0.0.2

Published by klis87 11 months ago

This is the first release of the new swr integration. Please check its documentation.

normy - @normy/react-query v0.13.0

Published by klis87 11 months ago

Updated @normy/core to 0.9.0 to get new mutation performance improvement.

normy - @normy/core v0.9.0

Published by klis87 11 months ago

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 - @normy/react-query v0.12.0

Published by klis87 11 months ago

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 - @normy/core v0.8.0

Published by klis87 11 months ago

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 - @normy/react-query v0.11.2

Published by klis87 12 months ago

This is the same as 0.11.1 - released to fix latest issues with npm.

normy - @normy/react-query v0.10.1

Published by klis87 12 months ago

Updated @normy/core to 0.7.2 to fix Date support.

normy - @normy/react-query v0.11.1

Published by klis87 12 months ago

Updated @normy/core to 0.7.2 to fix issues with Date objects.

normy - @normy/core v0.7.2

Published by klis87 12 months ago

Fix missing Date support, now your data can have Date objects and normalization will work fine. Thanks @garrettg123 for creating the issue.

normy - @normy/react-query v0.11.0

Published by klis87 12 months ago

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 - @normy/react-query v0.10.0

Published by klis87 12 months ago

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 - @normy/react-query v0.9.0

Published by klis87 about 1 year ago

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 - @normy/react-query v0.8.0

Published by klis87 over 1 year ago

Renamed getNormalisationObjectKey option into getNormalizationObjectKey.

normy - @normy/core v0.7.0

Published by klis87 over 1 year ago

Renamed getNormalisationObjectKey option into getNormalizationObjectKey.