lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
https://www.npmjs.com/package/@lukemorales/query-key-factory
MIT License
1.18k stars 32 forks source link

refactor: introduce `_def` and deprecate `default` and `toScope` #14

Closed lukemorales closed 2 years ago

lukemorales commented 2 years ago

This PR introduces _def as the new way to access what was previously known as default key or toScope method for serializable keys.

default and toScope continue to work, so this isn't a breaking change yet, but they are marked as deprecated and users will be warned that these functionalities will be removed in the next major version.

Tests were updated and improved on the assertions and consistency between setups, and docs were updated to use the new API and also improved with better examples