RFC: rework of queryParameters to return an object of stores instead of an actual object. #6
paoloricciuti
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the moment when you use
queryParameters
you get back a single store containing the mix of every key that you pass in + every other query parameter present in the URLyou can later access those inside your template like this
this is actually fine.
But i was thinking of caching the stores for the query parameters already created (to imporve performance and memory) and i tought of something: the queryParameters store could actually just be an object containing a bunch of small stores. One for every parameter. While this would create more stores it would help with code duplication inside the library and also would, imho, provide a better way to access those stores because you wouldn't need to always namespace them. Here's an example of the proposed usage.
each of the two methods brings it's own set of itches (to be fair i almost ever use
queryParam
but don't tell this toqueryParameters
it might offend it) and while i feel that the proposed method helps to use the variables inside the markup the need to destructure or reassigning the variables might be causes of bugs if someone doesn't read the documentation thoroughly.What do you guys think about this?
Beta Was this translation helpful? Give feedback.
All reactions