Pagination state
This PR adds support for sharing links with the pagination state, for example if you are on page 2 of a set of collection items and share the link the user will open to page 2 of the results.
I wouldn't say I'm overly happy with where the logic is placed in the store because in many regards this code should only run once when the app loads but I found it difficult to move the code anywhere else.
Still need to test what happens on static catalogs.
Note for self - there are some APIs that don't use the token param, for example this one uses startRecord, so probably need to work out how to make the handling more generic.
Yeah, this will only work for a small subset of APIs. Please check the API spec again regarding pagination because this doesn't really follow the spec. You'll may need to serialize the whole link in some cases. We should probably figure out some smart logic that only serializes what is really different in the link...
@m-mohr just pushed up a commit that basically serialises the whole link object, seems to work a bit more safely across different catalogs
Thanks. This is not how I expect this to work, the approach taken is too simple because now it gives an overly long URL in all cases. It should really detect whether a full serialization is required or whether only a query parameter has been added to the "base URL" and then only persist that specific parameter into the URL. Also, you only need to persist the parts related to the request from the Link Object.
I've made a minor tweak that slims down the url to only containing the querystring for GET request pagination. This isn't as s slim as possible but it's an improvement.
Part of the challenge around this is where we manage the state for limit and also the filter params like bbox and datetime, these things typically get captured in a GET href but are also part of the app state 🤯
Is that really an issue? The app state for the form seems unrelated to the actual search results and the pagination and as such should be stored separately. But maybe I'm not fully understanding the challenges yet.