-
Notifications
You must be signed in to change notification settings - Fork 92
API Pagination fixes #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Pagination fixes #1031
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good! Just a few other things I noticed that might be worth a look.
@@ -30,10 +30,21 @@ | |||
if (error) error = undefined; | |||
} | |||
|
|||
$: isEmpty = $store.visibleItems.length === 0 && !$store.loading; | |||
$: pageSizeChange = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- On a
Running
workflow the number ofvisibleItems
is increasing, but the total remains the same and it gets into a weird state such as in the screenshot above where there are 19 events, but it still says the total is 13. - If I pass in
pageSizeOptions
and change the number it will trigger a refetch, but it always just fetches all of the events. Do we want to updatefetchPaginatedEvents
to account for a page size? I realize it's probably fine to just have the default 100 for now, but thought I'd comment here in case we want to future proof this. - There is an unused
supportsReverseOrder
import inevents-service.ts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great finds!
- Because we have to fetch the start and end events for input/result/total event count plus the first page of events, there can be a mismatch on the total count due to timing. I.e start/end call resolves with 13 events, first page resolves with 19 events. I'll see if we can do something about that, but in a separate PR.
- Because the event history can never guarantee exactly how many events can be returned (it's batched), we don't use a pageSize option in getPaginatedEvents (_pageSize = 100 is there to appease the TS gods, but it's not actually used in the requestFromAPI).
- Removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the event history can never guarantee exactly how many events can be returned
Ah I forgot about this fun quirk 🤦♀️
* fix toast position and deprecate old notifications (#995) * standardize toast position at bottom right of screen * deprecate notifications in favor of toasts * fix broken imports * fix tests * move toast store * DT-187 - signal workflow (#980) * signal workflow * base64 encode payload * add JSON editor component using codemirror * format * rm unused dep * format * add cy test, refresh wf after signal * allow signal workflow to be toggled on/off * add signalEnabled to workflow-run-layout * rm await tick() * fix input required indicator * move codemirror theme definitions to their own file rename JSON-editor to json-editor * rename json-editor for real * add assertion to make sure modal closes * give json editor a max height and trap scroll * reset inputs on modal close * Event History API Pagination and Keyboard Navigation (#997) * Add api-pagination to event-history. Need to fix onPageChange vs. onPageSizeChange which causes double fetch * More fixes/refactoring * Get arrows right, refactor * more refactoring * Remove imports * Add keyboard shortcuts * WIP: update pagination store * WIP: pagination store * More WIP: * WIP: more work * Finally fix pagination with cached items. Remove nextIndex * more stuff. need to fix reset logic * Remove initialItem from api-pagination, update reste * Key on category/refresh/sort to reload event summary * Hide bottom controls if no items * Move arrow key shortcuts out of api-pagination * Refactor, update unit tests. Need to add more, use Set * Add some color * More unit tests * Update failing unit tests * Remove unused service call, need to figure out Cypress tests * Remove unused imports * Fix all type errors, refactor import routes to work * Fix heartbeat css * Fix lint errors, export perPageSize * Add shortcut modal * Reorder keyboard shortcuts * Use const * Add dateFilterValue helper function with tests * Make all the types better for event-summary-row/details... * More helper functions with tests * Add jklh keyboard shortcuts * Add supportsReverseOrder logic and fix all the cypress tests * More refactoring, move onFetch to a derived store * Automate NPM package release process (#988) * [skip actions] first pass at automating package * update bump input * don't package, only bump version * skip commit hooks * [skip actions] fix string interpolation * [skip actions] make a script for creating release * fix github actions for publishing to npm * rm unused scripts * fix env vars * fix publish package * use package.json version instead of tags * Add Github codeowners (#1013) * Sveltekit Upgrade (#1012) * svelte-migrate: renamed files * Complete initial migration to Sveltekit 1.0.0 * Bump to 1.0.1 of sveltekit * Fix mock for app * Update exports * Add sveltejs/package * Remove _ from holocene component names so they are added to package * Upgrade histoire and vercel-adapter * Refactor based on PR comments, remove commented out code, add type to single line imports * Add app version config to histoire * fix vite public path for histoire builds * Fix error type * Remove pollInterval in histoire * Add global var for histoire Co-authored-by: Laura Whitaker <laura.whitaker@temporal.io> Co-authored-by: Ross Edfort <rossedfort@gmail.com> * ignore .vercel for histoire (#1014) * Don't use ssr on workflows page to prevent weird jumping, remove hack for updateQueryParam (#1015) * [DT-139] Add link to child workflows for StartChildWorkflowExecutionInitiated (#1007) * Remove workflowExecution from label in event details * Get run id for workflow link on StartChildWorkflowExecutionInitiated event * Refactor to util and add unit tests * Remove child workflow execution link on StartChildWorkflowExecutionInitiated event * Add beta tag to npm version (#1018) * Run e2e tests against the current UI code via Temporal CLI (#1010) This builds the current UI code into Temporal CLI to run tests against. * disable SSR on Login and Signin page (#1019) * no ssr for login page * fix ssr disable * move login and signing Load fn to the layout move ssr disable to the layout * disable ssr at the root route (#1020) * Don't try to decode a null payloads (#1017) * Don't try to decode a null payload * Fix equality check Co-authored-by: Steve Kinney <hello@stevekinney.net> * Internal commit for Vercel Co-authored-by: Steve Kinney <hello@stevekinney.net> * Run prettier * Simplify e2e workflow. (#1024) * Add drawer component to holocene. Use drawer for keyboard shortcuts (#1027) * Fix lint issues. (#1025) * Add some docs for manually running e2e tests. (#1026) * Add some docs for manually running e2e tests. * Add some scripts to make it easier for manual running. * Update tests for update-query-param to remove addHash (#1029) * API Pagination fixes (#1031) * Add back No Items slot and update api-pagination to refetch on pageSize change * Bump beta tag * Remove unused import * Add defaultPageSize prop, cleanup * Add defaults for defaultPageOption, add unit tests * Use $lib/holocene instead of $holocene (#1033) * Use /holocene instead of if in holocene to fix imports of package * Fix lint * Remove all aliases * Remove rsync code and use svelte-package * Add back No Events Match for empty slot for Event History (#1035) * Remove beta label * Exclude e2e tests in vitest (#1036) Co-authored-by: Ross Edfort <rossedfort@gmail.com> Co-authored-by: Alex Tideman <alex.tideman@gmail.com> Co-authored-by: Ruslan <11838981+feedmeapples@users.noreply.github.com> Co-authored-by: Laura Whitaker <laura.whitaker@temporal.io> Co-authored-by: Rob Holland <rob@temporal.io> Co-authored-by: Loïc Minaudier <loic.minaudier@gmail.com>
…able to run (#1032) * fix toast position and deprecate old notifications (#995) * standardize toast position at bottom right of screen * deprecate notifications in favor of toasts * fix broken imports * fix tests * move toast store * DT-187 - signal workflow (#980) * signal workflow * base64 encode payload * add JSON editor component using codemirror * format * rm unused dep * format * add cy test, refresh wf after signal * allow signal workflow to be toggled on/off * add signalEnabled to workflow-run-layout * rm await tick() * fix input required indicator * move codemirror theme definitions to their own file rename JSON-editor to json-editor * rename json-editor for real * add assertion to make sure modal closes * give json editor a max height and trap scroll * reset inputs on modal close * Event History API Pagination and Keyboard Navigation (#997) * Add api-pagination to event-history. Need to fix onPageChange vs. onPageSizeChange which causes double fetch * More fixes/refactoring * Get arrows right, refactor * more refactoring * Remove imports * Add keyboard shortcuts * WIP: update pagination store * WIP: pagination store * More WIP: * WIP: more work * Finally fix pagination with cached items. Remove nextIndex * more stuff. need to fix reset logic * Remove initialItem from api-pagination, update reste * Key on category/refresh/sort to reload event summary * Hide bottom controls if no items * Move arrow key shortcuts out of api-pagination * Refactor, update unit tests. Need to add more, use Set * Add some color * More unit tests * Update failing unit tests * Remove unused service call, need to figure out Cypress tests * Remove unused imports * Fix all type errors, refactor import routes to work * Fix heartbeat css * Fix lint errors, export perPageSize * Add shortcut modal * Reorder keyboard shortcuts * Use const * Add dateFilterValue helper function with tests * Make all the types better for event-summary-row/details... * More helper functions with tests * Add jklh keyboard shortcuts * Add supportsReverseOrder logic and fix all the cypress tests * More refactoring, move onFetch to a derived store * Automate NPM package release process (#988) * [skip actions] first pass at automating package * update bump input * don't package, only bump version * skip commit hooks * [skip actions] fix string interpolation * [skip actions] make a script for creating release * fix github actions for publishing to npm * rm unused scripts * fix env vars * fix publish package * use package.json version instead of tags * Add Github codeowners (#1013) * Sveltekit Upgrade (#1012) * svelte-migrate: renamed files * Complete initial migration to Sveltekit 1.0.0 * Bump to 1.0.1 of sveltekit * Fix mock for app * Update exports * Add sveltejs/package * Remove _ from holocene component names so they are added to package * Upgrade histoire and vercel-adapter * Refactor based on PR comments, remove commented out code, add type to single line imports * Add app version config to histoire * fix vite public path for histoire builds * Fix error type * Remove pollInterval in histoire * Add global var for histoire Co-authored-by: Laura Whitaker <laura.whitaker@temporal.io> Co-authored-by: Ross Edfort <rossedfort@gmail.com> * ignore .vercel for histoire (#1014) * Don't use ssr on workflows page to prevent weird jumping, remove hack for updateQueryParam (#1015) * [DT-139] Add link to child workflows for StartChildWorkflowExecutionInitiated (#1007) * Remove workflowExecution from label in event details * Get run id for workflow link on StartChildWorkflowExecutionInitiated event * Refactor to util and add unit tests * Remove child workflow execution link on StartChildWorkflowExecutionInitiated event * Add beta tag to npm version (#1018) * Run e2e tests against the current UI code via Temporal CLI (#1010) This builds the current UI code into Temporal CLI to run tests against. * disable SSR on Login and Signin page (#1019) * no ssr for login page * fix ssr disable * move login and signing Load fn to the layout move ssr disable to the layout * disable ssr at the root route (#1020) * Don't try to decode a null payloads (#1017) * Don't try to decode a null payload * Fix equality check Co-authored-by: Steve Kinney <hello@stevekinney.net> * Internal commit for Vercel Co-authored-by: Steve Kinney <hello@stevekinney.net> * Run prettier * Simplify e2e workflow. (#1024) * Add drawer component to holocene. Use drawer for keyboard shortcuts (#1027) * Refactor pending activities to use Table component * Add slot to Tab component and remove amount prop * Fix lint issues. (#1025) * Add some docs for manually running e2e tests. (#1026) * Add some docs for manually running e2e tests. * Add some scripts to make it easier for manual running. * Update tests for update-query-param to remove addHash (#1029) * Add canceled badge to pending activities * API Pagination fixes (#1031) * Add back No Items slot and update api-pagination to refetch on pageSize change * Bump beta tag * Remove unused import * Add defaultPageSize prop, cleanup * Add defaults for defaultPageOption, add unit tests * Use $lib/holocene instead of $holocene (#1033) * Use /holocene instead of if in holocene to fix imports of package * Fix lint * Remove all aliases * Remove rsync code and use svelte-package * Add back No Events Match for empty slot for Event History (#1035) * Update icon snapshot test Co-authored-by: Ross Edfort <rossedfort@gmail.com> Co-authored-by: Alex Tideman <alex.tideman@gmail.com> Co-authored-by: Ruslan <11838981+feedmeapples@users.noreply.github.com> Co-authored-by: Rob Holland <rob@temporal.io> Co-authored-by: Loïc Minaudier <loic.minaudier@gmail.com> Co-authored-by: Steve Kinney <hello@stevekinney.net>
What was changed
empty
slot to support custom no results pages and default 'No items' text if no visibleItemsWhy?
Support custom no items UI and fix bug when picking a new page size in the dropdown doesn't trigger a refetch with the page size.