feat: export default encoder/decoder for pre-setting table URL parameters#487
Merged
feat: export default encoder/decoder for pre-setting table URL parameters#487
Conversation
…default values - Introduced a new `encoder-decoder` module to handle encoding and decoding of global filter values. - Updated `encodeGlobalFilter` and `decodeGlobalFilter` functions to accept options for customizable default values. - Modified `useGlobalFilter` to utilize the new options structure. - Added tests to ensure correct functionality of the new encoder-decoder logic. - Updated package.json and tsup.config.ts to include the new module in the build process.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Deploying tanstack-table-search-params-tanstack-router with
|
| Latest commit: |
4558440
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ba030567.tanstack-table-search-params-tanstack-router.pages.dev |
| Branch Preview URL: | https://export-encoder-and-decoder.tanstack-table-search-params-tanstack-router.pages.dev |
Deploying tanstack-table-search-params-react-router-lib with
|
| Latest commit: |
4558440
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8876fdea.tanstack-table-search-params-react-router-lib.pages.dev |
| Branch Preview URL: | https://export-encoder-and-decoder.tanstack-table-search-params-react-router-lib.pages.dev |
… values - Updated `encodeSorting` and `decodeSorting` functions to accept an options parameter for customizable default values. - Modified the `useSorting` hook to utilize the new options structure for decoding and encoding sorting parameters. - Enhanced tests for sorting to validate the new options functionality. - Updated the encoder-decoder index to export the new sorting functions.
- Modified `encodeGlobalFilter` and `decodeGlobalFilter` functions to accept an optional `defaultValue` parameter. - Updated `encodeSorting` and `decodeSorting` functions similarly to enhance flexibility in handling sorting parameters. - Ensured consistency across encoder-decoder modules for better usability.
…ult values - Updated `encodePagination` and `decodePagination` functions to accept an options parameter for customizable default values. - Modified the `usePagination` hook to utilize the new options structure for encoding and decoding pagination parameters. - Enhanced tests for pagination to validate the new options functionality. - Updated the encoder-decoder index to export the new pagination functions.
- Updated test cases for `globalFilter` and `sorting` to ensure consistent handling of `defaultValue` types. - Refactored type definitions to improve clarity and maintainability across test files. - Ensured that the tests accurately reflect the expected behavior of the encoder-decoder functions.
…fault values - Updated `encodeColumnFilters` and `decodeColumnFilters` functions to accept an options parameter for customizable default values. - Refactored the handling of default values in the `useColumnFilters` hook to align with the new options structure. - Modified tests for columnFilters to validate the new options functionality. - Updated the encoder-decoder index to export the enhanced columnFilters functions.
…ult values - Updated `encodeColumnOrder` and `decodeColumnOrder` functions to accept an options parameter for customizable default values. - Refactored the `useColumnOrder` hook to utilize the new options structure for encoding and decoding column order parameters. - Modified tests for columnOrder to validate the new options functionality. - Updated the encoder-decoder index to export the enhanced columnOrder functions.
…ests - Updated test cases for columnFilters, columnOrder, globalFilter, pagination, and sorting to ensure consistent handling of `defaultValue` types. - Refactored type definitions to improve clarity and maintainability across all test files. - Ensured that the tests accurately reflect the expected behavior of the encoder-decoder functions.
- Introduced a new FAQ section explaining how to preset query parameters when navigating to a page with a table. - Provided a code example demonstrating the use of `encodeSorting` from the encoder-decoder module to set initial table state via URL. - Updated both main and package-specific README files for consistency.
2d75ced to
4558440
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #470
What’s new in this PR
Default encoder / decoder are now exported.
You can import them from
tanstack-table-search-params/encoder-decoder.Use the default encoder when pre-setting URL parameters.
When you need to navigate to a page that contains a table and want to attach query parameters ahead of time, you can now rely on the default encoder.