-
Notifications
You must be signed in to change notification settings - Fork 702
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
Make pagination UI-driven, but based upon server's tokens #5185
Make pagination UI-driven, but based upon server's tokens #5185
Conversation
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
❌ Deploy Preview for kubeapps-dev failed.Built without sensitive environment variables
|
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
@@ -149,30 +151,32 @@ export default function Catalog() { | |||
cluster, | |||
namespace, | |||
reposFilter, | |||
nextPageToken, | |||
localNextPageToken, |
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.
Why renaming the variable? Why is important the nuance of "local"?
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.
Becasue nextPageToken
is coming from the global packages state and localNextPageToken
is a copy of this value, but in the component's state. This way, we have fine-grained control of the lifecycle of the state.
In fact, this is the crux of the PR: nextPageToken
gets updated each time new data arrives (that's why it was failing).
So, technically we are not renaming but storing a local copy of nextPageToken
and managing how it should be updated (that is, on each pagination event).
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.
LGTM
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com> Conflicts: dashboard/src/components/Config/AppRepoList/AppRepoForm.tsx
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com> Conflicts: dashboard/src/components/Catalog/Catalog.test.tsx dashboard/src/components/Catalog/Catalog.tsx
Description of the change
Example of my local's vs what is currently on
main
just accessing/#/c/default/ns/default/catalog
:Benefits
Fewer initial requests and better UX, as endless pagination will work as it is expected to.
Possible drawbacks
N/A
Applicable issues
Additional information
Squeezing a minor linter-related change.