0

I have a react-admin app where we are making frequent changes.

Is there an existing plugin or a way to detect a new version of app and provide user with a toast to refresh the application so that they are working with latest version?

If not with react-admin, is anyone familiar with a way to do this easily with react?

I have found some manual way to do this in following places but I am asking here in case there is an existing package or a more elegant solution that I can leverage directly.

How to force update Single Page Application (SPA) pages? https://medium.com/@kellyrmilligan/create-react-app-let-your-users-know-when-the-app-has-been-updated-with-a-notification-21335d85481c

Any help is appreciated even if its, nothing exist and I should just hand-roll.

Thanks for reading.

akshah123
  • 708
  • 1
  • 5
  • 10
  • When you distribute the app, make sure it has its version in a resource that you can access at runtime. Then put the latest version number online somewhere where your app can pull it and check against the current version. This will likely involve you rolling your own server or using an existing database. – Dylan Dec 17 '18 at 17:47

2 Answers2

0

This is not the responsibility of React Admin to handle this kind of issue. You can think of RA as a simple React component that helps you define an admin.

Hence, RA doesn't provide any helper to manage code update or something similar.

You have to implement this refresh system by hand, and your links are a good start for that.

Kmaschta
  • 2,369
  • 1
  • 18
  • 36
0

With the serviceWorker you can do that : https://github.com/marmelab/react-admin/blob/master/examples/tutorial/src/registerServiceWorker.js

But i don't know why in the demo the service worker is not used ? https://github.com/marmelab/react-admin/tree/master/examples/demo/src

sorcer1
  • 117
  • 3
  • 11
  • The tutorial is created from the create-react-app command: https://github.com/facebook/create-react-app By default, this service worker is generated, this is unrelated to react admin (but it's common to start a React Admin via a create-react-app) – Kmaschta Dec 18 '18 at 19:38