-
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 letters are skipped when typing fast #194009
Conversation
Pinging @elastic/appex-sharedux (Team:SharedUX) |
updateFilterFromURL(urlState.filter); | ||
}, [urlState, buildQueryFromText, urlStateEnabled]); | ||
updateQueryFromURL(initialUrlState.s); | ||
updateSortFromURL(initialUrlState.sort); |
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.
Now that I re-read the code, I am surprise we call sometimes twice dispatch onTableChange
. But I guess that's a tiny optimisation
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.
it could be a good optimizaiton now, but would be automatically batched with react@18
I'd not touch to not break for now
@@ -849,12 +848,10 @@ function TableListViewTableComp<T extends UserContentCommonSchema>({ | |||
}); | |||
} | |||
|
|||
if (data.page || !urlStateEnabled) { |
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.
What is the reason to remove the condition?
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.
So now I want to always call dispatch directly, because it is the source of state now even when url is enabled.
previosly it was called only if there is a page
change or if url state was disabled
@elasticmachine merge upstream |
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! Tested locally and works as expected 👍
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11104190598 |
) (cherry picked from commit 23effbe)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…) (#194407) # Backport This will backport the following commits from `main` to `8.x`: - [[TableListView] Fix letters are skipped when typing fast (#194009)](#194009) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-30T10:24:09Z","message":"[TableListView] Fix letters are skipped when typing fast (#194009)","sha":"23effbedd4f88219b71088b34d8e9221527e7a91","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor","Component:TableListView"],"title":"[TableListView] Fix letters are skipped when typing fast","number":194009,"url":"https://github.com/elastic/kibana/pull/194009","mergeCommit":{"message":"[TableListView] Fix letters are skipped when typing fast (#194009)","sha":"23effbedd4f88219b71088b34d8e9221527e7a91"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194009","number":194009,"mergeCommit":{"message":"[TableListView] Fix letters are skipped when typing fast (#194009)","sha":"23effbedd4f88219b71088b34d8e9221527e7a91"}}]}] BACKPORT--> Co-authored-by: Anton Dosov <[email protected]>
Summary
Fix #193879 - I noticed this buggy behaviour before but haven't looked into it closer. But React@18 highligted major problems with how state works in that component that must be fixed before the upgrade.
I think the largest issue that is hard to fix or workaround is that rebuidling a query from url string is async:
kibana/packages/content-management/table_list_view_table/src/table_list_view_table.tsx
Lines 1033 to 1043 in 7b76160
And this doesn't work nicely with controlled input
This PR fixes #193879 by "degrading" the url syncing behavior to only picking up the initial state from the URL. I wasn't sure how to refactor nicely the current logic so that it doesn't lag, so decided to simplify the functionality assuming that the lost syncing is not very usefull anyway.