eui icon indicating copy to clipboard operation
eui copied to clipboard

[EuiSuperDatePicker] Component prop updates interfere with auto-refresh functionality

Open weltenwort opened this issue 6 years ago • 2 comments

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 onRefresh prop 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 isPaused prop changes, cancel or start the timeout accordingly.

weltenwort avatar Oct 24 '19 10:10 weltenwort

I am working to fix this issue

amitsin6h avatar Mar 20 '20 03:03 amitsin6h

Does this still need someone to work on it?

jessemchung avatar Aug 24 '24 07:08 jessemchung

Hello, I’m new to contributing to this project and would love to take this issue. Could I be assigned to it?

cmdsreedev avatar Sep 14 '25 04:09 cmdsreedev