-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[TableListView] Fix regression when resetting search #162034
[TableListView] Fix regression when resetting search #162034
Conversation
d909e54
to
2d6647a
Compare
Pinging @elastic/appex-sharedux (Team:SharedUX) |
2d6647a
to
a27cbf8
Compare
I am able to see flashing UI in this PR. To view, open visualize listing page when you have no visualization saved objects. In the empty case, the table should never be displayed. Screen.Recording.2023-07-17.at.8.53.05.AM.mov |
Would it be possible to remove The problem is that fetchItems is called twice when the page loads.
|
Can you retest now. I fixed it here 2a6f300
No because that would open the door for other future regression. We want to fetch the items any time any of the dependency change. const onFetchSuccess = useCallback(() => {
if (!hasInitialFetchReturned) {
setHasInitialFetchReturned(true);
}
}, [hasInitialFetchReturned]); That was a mistake from Andrew. The function that update the state has the state as a dependency. Usually a source of infinite re-render. I changed it here 07a237a |
totalItems: 0, | ||
hasInitialFetchReturned: false, | ||
isFetchingItems: false, | ||
isFetchingItems: true, |
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 are you defaulting to isFetchingItems is true?
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.
That's the state when he table mount: it fetches the items.
We initially had an useEffect
+ useDebounce
. You correctly removed the effect (#159507) so we only have one of the 2 but we need to wait 300ms
before having this state set to true
.
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
code review, tested in chrome
Thanx @sebelga The only bug I found is also depicted on the failing graph test. ![]() |
Thanks for the review @nreese and @stratoula! 👍
Yes indeed, good catch. I fixed it in 4d57f17 |
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.
This looks fantastic! Thanx @sebelga ❤️
Tested different scenarios and everything works as expected 🥇
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.
tested, works well
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
History
To update your PR or re-run it, just comment with: cc @sebelga |
Does it make sense to backport this for 8.9? |
I would vote yes, since #160650 is in 8.9.0 |
Is there a label we can add now or do I need to use the script? |
You need to use the script unfortunately afaik |
For the record, @pheyos mentioned that adding the Whatever gets the job done 👍 |
(cherry picked from commit c6deb25)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
(cherry picked from commit c6deb25)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…162211) # Backport This will backport the following commits from `main` to `8.9`: - [[TableListView] Fix regression when resetting search (#162034)](#162034) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sébastien Loix","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-07-18T11:47:01Z","message":"[TableListView] Fix regression when resetting search (#162034)","sha":"c6deb252b2a2830ad1d689c476517f783247206b","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:SharedUX","Feature:Content Management","backport:prev-minor","Component:TableListView","v8.10.0"],"number":162034,"url":"https://github.com/elastic/kibana/pull/162034","mergeCommit":{"message":"[TableListView] Fix regression when resetting search (#162034)","sha":"c6deb252b2a2830ad1d689c476517f783247206b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/162034","number":162034,"mergeCommit":{"message":"[TableListView] Fix regression when resetting search (#162034)","sha":"c6deb252b2a2830ad1d689c476517f783247206b"}}]}] BACKPORT--> Co-authored-by: Sébastien Loix <[email protected]>
In #160650 we introduced a regression. When clearing a search request that didn't contain any result we were taking back to the empty prompt.
I reversed the changed in the PR to fix it and I added tests to prevent future regression for this.
@nreese
Strangely enough I am not able to reproduce the issue you fixed after reverting your changes. I switched to "slow 3g" network as per your comment here #148557 (comment) but still could not reproduce the UI flashing issue.I wonder if the fix needed from your PR was adding this useCallback (https://github.com/elastic/kibana/pull/160650/files#diff-7b0b3bede33bed7e2f5f7095697650d92c8ec131e29b9fccc384cacafad84689R84-R88)[EDIT] I manage to reproduce. It only occurred when there are no items in the table.
Other fix
I also fixed the flaky test (#160178) that Nathan had fixed in his PR by making sure that once we detect that there no items we don't remove the empty prompt.
"Glitch" that has been fixed
Notice how we go from "No files found" (empty prompt) --> "Table" (no files match your search) --> "No files found".
Fixes #161288
Fixes #160178