React-admin: Move useRefreshWhenVisible outside layout; enable opt-in and delay props

Created on 14 Jul 2020  路  2Comments  路  Source: marmelab/react-admin

Is your feature request related to a problem? Please describe.
I understand the use of #4582 useRefreshWhenVisible (forcing browser refresh if outside tab for 5 minutes) but having it baked into the layout has proven to be troublesome with our userbase. While it makes sense to pull in latest data on list view, it is resulting in confusion with our users when they are on forms and their inputs get wiped. Due to our type of work, users will typically leave a form open for a while as they fill out and get info from outside the app or discuss, etc.

Describe the solution you'd like
Move useRefreshWhenVisible to the major page components (Edit, List, SimpleForm, TabbedForm). Add forceRefresh (boolean) and refreshDelay (number) props so developers can disable and change delay by page.

Describe alternatives you've considered
In the very least, add these two props to the AppBar component so we can disable across the site entirely. Ideally, we'd like if it can be put to use on lists but disabled on forms.

Most helpful comment

I think we should reconsider this feature request. As seen in #4698, the auto-refresh feature introduces problems, and it should be either disabled by default, or very easy to disable.

All 2 comments

Thanks for your feature request.

This is achievable by providing a custom Layout using a custom AppBar. Indeed the LoadingIndicator component is only used in by the AppBar. You could then declare custom Edit and Create components, or custom Form components which would use the hook where needed

I think we should reconsider this feature request. As seen in #4698, the auto-refresh feature introduces problems, and it should be either disabled by default, or very easy to disable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kmaschta picture Kmaschta  路  3Comments

kikill95 picture kikill95  路  3Comments

mbj36 picture mbj36  路  3Comments

ericwb picture ericwb  路  3Comments

pixelscripter picture pixelscripter  路  3Comments