-
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
[Controls] Debounce time slider selections #201885
Conversation
Pinging @elastic/kibana-presentation (Team:Presentation) |
aef5b6c
to
924d07d
Compare
src/plugins/controls/public/controls/timeslider_control/get_timeslider_control_factory.tsx
Outdated
Show resolved
Hide resolved
d3d7d7d
to
9ebee93
Compare
464af43
to
983cf27
Compare
src/plugins/controls/public/controls/timeslider_control/get_timeslider_control_factory.tsx
Outdated
Show resolved
Hide resolved
src/plugins/controls/public/controls/timeslider_control/get_timeslider_control_factory.tsx
Outdated
Show resolved
Hide resolved
/ci |
...ugins/controls/public/controls/timeslider_control/components/time_slider_popover_content.tsx
Outdated
Show resolved
Hide resolved
const rangeInput = isAnchored ? ( | ||
<TimeSliderAnchoredRange | ||
value={props.value} | ||
onChange={props.onChange} | ||
stepSize={props.stepSize} | ||
ticks={props.ticks} | ||
timeRangeMin={props.timeRangeMin} | ||
timeRangeMax={props.timeRangeMax} | ||
compressed={props.compressed} | ||
value={[displayedValue[0] || timeRangeMin, displayedValue[1] || timeRangeMax]} | ||
onChange={(newValue) => { | ||
setDisplayedValue(newValue as Timeslice); | ||
debouncedOnChange(newValue); | ||
}} | ||
stepSize={stepSize} | ||
ticks={ticks} | ||
timeRangeMin={timeRangeMin} | ||
timeRangeMax={timeRangeMax} | ||
compressed={compressed} | ||
/> | ||
) : ( | ||
<TimeSliderSlidingWindowRange | ||
value={props.value} | ||
onChange={props.onChange} | ||
stepSize={props.stepSize} | ||
ticks={props.ticks} | ||
timeRangeMin={props.timeRangeMin} | ||
timeRangeMax={props.timeRangeMax} | ||
compressed={props.compressed} | ||
value={[displayedValue[0] || timeRangeMin, displayedValue[1] || timeRangeMax]} | ||
onChange={(newValue) => { | ||
setDisplayedValue(newValue as Timeslice); | ||
debouncedOnChange(newValue); | ||
}} | ||
stepSize={stepSize} | ||
ticks={ticks} | ||
timeRangeMin={timeRangeMin} | ||
timeRangeMax={timeRangeMax} | ||
compressed={compressed} |
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.
We should definitely refactor this at some point - there is no reason to have these as two separate components 🤦 Not related to this PR, though - this is just super old code that hasn't been cleaned up in awhile.
src/plugins/controls/public/controls/timeslider_control/get_timeslider_control_factory.tsx
Show resolved
Hide resolved
...ugins/controls/public/controls/timeslider_control/components/time_slider_popover_content.tsx
Outdated
Show resolved
Hide resolved
...ugins/controls/public/controls/timeslider_control/components/time_slider_popover_content.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Hannah Mudge <[email protected]>
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
|
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 locally + code review - thanks so much for tackling this! It works great 🎉
Starting backport for target branches: 8.x |
## Summary This PR fixes the [[Controls] Debounce time slider selections](elastic#193227) issue. Previously when the user was dragging the time slider, the dashboard would be updating constantly causing lagging on more complex dashboards. This PR adds a local state that will hold the updating values while the user is dragging, and updates the dashboards once the user stops dragging with a delay of 300. https://github.com/user-attachments/assets/45bca92e-f92a-4c1f-8417-a0a0818c7415 --------- Co-authored-by: Hannah Mudge <[email protected]> Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 87d15ba)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary This PR fixes the [[Controls] Debounce time slider selections](elastic#193227) issue. Previously when the user was dragging the time slider, the dashboard would be updating constantly causing lagging on more complex dashboards. This PR adds a local state that will hold the updating values while the user is dragging, and updates the dashboards once the user stops dragging with a delay of 300. https://github.com/user-attachments/assets/45bca92e-f92a-4c1f-8417-a0a0818c7415 --------- Co-authored-by: Hannah Mudge <[email protected]> Co-authored-by: kibanamachine <[email protected]>
# Backport This will backport the following commits from `main` to `8.x`: - [[Controls] Debounce time slider selections (#201885)](#201885) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Paulina Shakirova","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-19T16:33:11Z","message":"[Controls] Debounce time slider selections (#201885)\n\n## Summary\n\nThis PR fixes the [[Controls] Debounce time slider\nselections](#193227) issue.\n\nPreviously when the user was dragging the time slider, the dashboard\nwould be updating constantly causing lagging on more complex dashboards.\nThis PR adds a local state that will hold the updating values while the\nuser is dragging, and updates the dashboards once the user stops\ndragging with a delay of 300.\n\n\nhttps://github.com/user-attachments/assets/45bca92e-f92a-4c1f-8417-a0a0818c7415\n\n---------\n\nCo-authored-by: Hannah Mudge <[email protected]>\nCo-authored-by: kibanamachine <[email protected]>","sha":"87d15ba2e1b9f7fef30eee2f202da78fe9635e07","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","v9.0.0","backport:prev-minor","papercut"],"title":"[Controls] Debounce time slider selections","number":201885,"url":"https://github.com/elastic/kibana/pull/201885","mergeCommit":{"message":"[Controls] Debounce time slider selections (#201885)\n\n## Summary\n\nThis PR fixes the [[Controls] Debounce time slider\nselections](#193227) issue.\n\nPreviously when the user was dragging the time slider, the dashboard\nwould be updating constantly causing lagging on more complex dashboards.\nThis PR adds a local state that will hold the updating values while the\nuser is dragging, and updates the dashboards once the user stops\ndragging with a delay of 300.\n\n\nhttps://github.com/user-attachments/assets/45bca92e-f92a-4c1f-8417-a0a0818c7415\n\n---------\n\nCo-authored-by: Hannah Mudge <[email protected]>\nCo-authored-by: kibanamachine <[email protected]>","sha":"87d15ba2e1b9f7fef30eee2f202da78fe9635e07"}},"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/201885","number":201885,"mergeCommit":{"message":"[Controls] Debounce time slider selections (#201885)\n\n## Summary\n\nThis PR fixes the [[Controls] Debounce time slider\nselections](#193227) issue.\n\nPreviously when the user was dragging the time slider, the dashboard\nwould be updating constantly causing lagging on more complex dashboards.\nThis PR adds a local state that will hold the updating values while the\nuser is dragging, and updates the dashboards once the user stops\ndragging with a delay of 300.\n\n\nhttps://github.com/user-attachments/assets/45bca92e-f92a-4c1f-8417-a0a0818c7415\n\n---------\n\nCo-authored-by: Hannah Mudge <[email protected]>\nCo-authored-by: kibanamachine <[email protected]>","sha":"87d15ba2e1b9f7fef30eee2f202da78fe9635e07"}}]}] BACKPORT--> Co-authored-by: Paulina Shakirova <[email protected]>
Summary
This PR fixes the [Controls] Debounce time slider selections issue.
Previously when the user was dragging the time slider, the dashboard would be updating constantly causing lagging on more complex dashboards. This PR adds a local state that will hold the updating values while the user is dragging, and updates the dashboards once the user stops dragging with a delay of 300.
Screen.Recording.2024-11-27.at.11.21.41.mov