Closed paoloricciuti closed 8 months ago
Latest commit: e907ec2de02698756233f47b4b2ffd5dc105f14a
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The recent updates introduce sorting of query parameters to enhance cache hit rates for HTTP requests. By default, parameters are alphabetically sorted, and developers can customize this behavior or opt out entirely. Changes across several files ensure consistent handling of query parameters, including their declaration, storage, and testing.
File(s) | Change Summary |
---|---|
.gitignore |
Added "test-results" directory to ignore list. |
README.md , .../+page.svelte , .../queryparameters/+page.svelte |
Updated Svelte component code for handling query parameters with sorting and default values. |
src/lib/sveltekit-search-params.ts |
Enhanced StoreOptions interface and functions for conditional sorting of query parameters. |
tests/index.test.ts |
Added and updated test cases to verify alphabetical ordering and custom sorting functionality. |
Objective | Addressed | Explanation |
---|---|---|
Sort params in URL to improve browser cache hit rate (#51) | ✅ | The changes ensure that query parameters are sorted to improve the cache hit rate, addressing the issue's requirements effectively. |
To sort or not, a choice to make, 🐰
With parameters in line, a cache hit rate at stake.
A rabbit hops through code with glee,
For URLs aligned, as neat as can be. 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?
Name | Link |
---|---|
Latest commit | e907ec2de02698756233f47b4b2ffd5dc105f14a |
Latest deploy log | https://app.netlify.com/sites/sveltekit-search-params/deploys/657d6ca28a397200089d6471 |
Deploy Preview | https://deploy-preview-56--sveltekit-search-params.netlify.app/ |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Closes #51
This adds sorting before navigating to allow for better cache-ability. This is technically a breaking change (?) but i'm a bit unsure about the consequences that it might have so i might keep it as a minor
Summary by CodeRabbit
Documentation
queryParam
andqueryParameters
functions with improved examples.New Features
arr_unordered
that maintains an unordered list.unordered_store
to manage the state of unordered arrays in the UI.Refactor
queryParameters
andqueryParam
functions with asort
option to control the sorting of query parameters.Tests