-
Notifications
You must be signed in to change notification settings - Fork 289
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
Fixes #33276 - Improve TableWrapper change tracking for search & pagination #9727
Fixes #33276 - Improve TableWrapper change tracking for search & pagination #9727
Conversation
Issues: #33276 |
one remaining bug: Set perPage to 10 (or a non-default value) on the Filters tab, go to Histories, set a perPage, then go back to Filters. This would sometimes cause an infinite API call loop, with the per_page alternating between the default 20 and whatever you set it to. I think this is caused by pages that store metadata in state. I removed |
webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js
Outdated
Show resolved
Hide resolved
5ca3896
to
116bbae
Compare
Updated and rebased:
In the future, we should also think about if we still need to store filters in |
@sjha4 It was because that page wasn't passing I also found another bug where if you have an active search (type = security), and try to advance the page, it would go into an infinite loop. I think that was because the pagination override logic was clearing |
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.
Phlegmless ACK!
@sjha4 That component also doesn't pass |
do we have to make it a required prop for tableWrapper? won't that just mean that a ton of tables will pass in an empty array |
Ended up not changing the required props. We probably should think about a solution though, as we now have 2 unenforced requirements:
anyway, it's ready for review again :) |
I'm thinking maybe it's safer to have activeFilters always treated as if they are additionalListeners, and not require you to add them explicitly. thoughts? (Could be a follow-up PR.) |
Like the idea to avoid duplicating putting filters in 2 props.. |
The
spawnFetch
function withinTableWrapper
tracks several changes and prevents sending duplicate API requests for search and pagination. The changes tracked areprevRequest
- Don't send a request if it has the same metadata as the previously-sent requestpaginationChangePending
- Don't send a request with stale data if the user has clicked on a pagination button and the request is still in flightprevSearch
- Don't send duplicate requests with the same search queryadditionalListeners
- Send a new request ifadditionalListeners
has changed, even if all of the above conditions would otherwise prevent itactiveFilters
was supposed to be tracking changes, but it wasn't. This caused pagination to be reset to page 1 when it shouldn't be.Also,
paginationChangePending
wasn't getting reset when it should be.What are the changes introduced in this pull request?
activeFilters
from a boolean prop to an array of stringsactiveFilters
spawnFetch
so that logic is more readablepaginationChangePending
when resetting to page 1paginationChangePending
before triggering a user pagination change (onPaginationChange
)additionalListeners
have changed, even if stale pagination data would otherwise prevent itWhat are the testing steps for this pull request?
You may want to check out the first commit, which has a lot of useful console logs added.
Load a page with filters, such as the Content Views tab of a composite content view
Change to page 2 > this should respond on the first click
Change filter from 'All' to 'Not added' > this should respond normally and not cause an infinite loop
Change filter from 'Not added' to 'Added' > this should respond normally and not cause an infinite loop
also make sure changing per_page works everywhere