feat(web): auto-paginate events page #661
Merged
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.
This ended up being a lot larger than originally imagined, because of the need to lump multiple things together.
1. Adds an
api
layerThese custom hooks in
web/api/index.jsx
handle fetching data and retaining in-memory cache of the API requests, given the query parameters. They include aforceRefetch
argument to allow replacing the cache with the results of a new call. If this parameter is not included (and is not unique since the last time it was used), the data will be reused from memory instead of attempting to query the API again.This introduces a small dependency,
immer
, which allows us to ensure data stored is immutable and easy to update in the reducers.2. Adds auto-pagination to the Events page
before
andafter
timestampsEvents
page using a reducer to track all events across paginated queriesIntersectionObserver
to watch the last row of the table to determine if it should attempt to fetch more eventslimit
(hard-coded to 25, ~10kB JSON 馃帀 ), assume we've reached the end of available events and stops looking for more3. Adds top-level filters to Events page
<select>
dropdowns that update the page, clearing the current set of events displayed on changecloses #648
closes #601
closes #650
Tested on Chrome, Firefox, and Safari (all latest)