silverstripe / silverstripe-asset-admin

Silverstripe assets gallery for asset management
BSD 3-Clause "New" or "Revised" License
19 stars 78 forks source link

Use caching instead of polling in HistoryList #1412

Open sabina-talipova opened 8 months ago

sabina-talipova commented 8 months ago

Description

To determine if the history list requires a refresh we send request every 250 ms in refreshHistoryIfNeeded.

This needs a delay/throttle, so this api request tries to be made last in the stack. We also use this to stop an API call happening if the component is going to unmount soon.

This could potentially be solved by using apollo-client's caching and graphql. See: https://github.com/silverstripe/silverstripe-asset-admin/blob/02728e1adcf5c912b3ab0d8dc64963a717139d0f/client/src/containers/HistoryList/HistoryList.js#L78