EasyCorp / EasyAdminBundle

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

[Chrome] Custom actions execute twice #6477

Open KDederichs opened 6 days ago

KDederichs commented 6 days ago

Describe the bug Ok this is gonna be a weird one:

I have an issue where custom actions execute twice but ONLY in Chrome (Firefox and Safari are fine).

To Reproduce I tried to replicate this behavior on the local test environment but there it doesn't seem to happen, so no clue. On Prod it does that every them when you open a custom action with Chrome.

(OPTIONAL) Additional context

I don't think it's related but the website is running on a Plesk server (the usual nginx into apache php-fpm setup)

Anyone ever experienced anything remotely similar and knows what's up with that?

KDederichs commented 6 days ago

Looking at the webserver logs it also shows the request going out twice so I'm a bit unsure if it's a Chrome thing or an easy admin thing: Screenshot 2024-10-15 at 15 44 42

we did test it on two different machines though and on both it's doing that (on one it's even stock Chrome freshly downloaded)

KDederichs commented 6 days ago

Ok it might be Chrome's prefetching (it doesn't do that locally which explains why I can't reproduce it) Does easy admin check for prefetching or does it just execute what ever is in the action when the prefetch hits? (Yes I know you aren't supposed to mutate data GET but there's not really another way with EA actions as far as I am aware)

KDederichs commented 2 days ago

It is indeed Chrome prefetching. By adding some code to detect this and then just return an empty page the problem is fixed.

Now the question is if we should do this by default in EasyAdmin or if possible have some config to ignore those prefetch request.