EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
4.09k stars 1.02k forks source link

[RFC] Real-time push notifications with mercure when entities are modified by someone else #5765

Open slim opened 1 year ago

slim commented 1 year ago

When editing an Entity, if another user updates the same entity in the mean time, you end up overwriting his update with outdated data without knowing. Which could be an irrecoverable and undetectable data loss. Using Mercure for real-time server side push notifications we can notify the user when this happens.

This could be an optional feature such as if you composer require mercure in your project the feature gets activated and users start receiving real time push notifications when the page they are looking at, whether it is an editing or an index page, is not up to date any more

You can setup a demo of the feature here : https://github.com/coopTilleuls/easyadmin-mercure-demo

Capture d’écran de 2023-05-25 08-54-14

Capture d’écran de 2023-05-25 15-54-44

dunglas commented 1 year ago

This is indeed a nice use case for Mercure.

In API Platform Admin we even go one step further by automatically updating the data displayed in views and in forms in real-time when they change. This could probably be achieved in EasyAdmin using Symfony UX Turbo (Turbo Streams). This would avoid having to click on the "reload" button and provide an awesome UX, but let's take it one step at a time, this functionality can always be added later.

Regarding your proposal, may I suggest a more explicit message such as The data displayed in the form is outdated (it has been changed by another user). < Reload 🔄 >?

Also, this would be quite easy to display the list of other users currently editing the same form (similar to what Google Docs does), but again this could be done in a follow up patch.