eui
eui copied to clipboard
[EuiSuperDatePicker] Component prop updates interfere with auto-refresh functionality
Problem description
The SuperDatePicker currently restarts a pending auto-refresh interval on every prop change:
https://github.com/elastic/eui/blob/f879d1288e8a13f268c97fd67c1f2f772891c0b8/src/components/date_picker/super_date_picker/super_date_picker.js#L195-L200
The effect is that the auto-refresh is never triggered if the component's props change more frequently than the auto-refresh interval.
Proposed solution
- When the
onRefreshprop changes, replace the handler reference without changing the timeout. - When the interval increases...
- cancel the previous timeout.
- schedule a new timeout with the remaining time.
- schedule all future timeouts with the new interval.
- When the interval decreases...
- cancel the previous timeout.
- call the handler immediately if the shorter timeout would have elapsed.
- schedule a new timeout with the remaining time if the shorter timeout wouldn't have elapsed.
- When the
isPausedprop changes, cancel or start the timeout accordingly.
I am working to fix this issue
Does this still need someone to work on it?
Hello, Iām new to contributing to this project and would love to take this issue. Could I be assigned to it?