inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Debounce remember method

Open sebastiandedeyne opened this issue 4 years ago • 1 comments

Safari has this bonkers limitation of limiting pushState and replaceState calls to 100 times per 30 seconds. That's 3 calls per second. Clicking around an app won't cause this, but binding Inertia.remember to a textfield can. The problem here is that once Safari throws the error, all navigation breaks.

Screenshot 2021-01-05 at 18 35 35

To work around this issue, we could add a debounce to the remember method at about 400ms. 333ms would work, but better to have some leeway.

Unable to test this atm, but this is my idea on how we can debounce the remember method without interfering with other pushState/replaceState calls.

I'm not sure about the code, the debounce placement is ugly, and I don't like the cancelRemember switch, but we can at least discuss and play around with this PR.

sebastiandedeyne avatar Jan 05 '21 18:01 sebastiandedeyne

Ridiculous, @WebKit..

Perhaps there's some Safari check we can do, to prevent handicapping Chrome, Edge, Firefox etc.? Even clicking a link/button/whatever can easily be done in under 150ms, not even to mention situations in which you really put your mind to it (eg. a web-game like cookie clicker)

claudiodekker avatar Jan 06 '21 10:01 claudiodekker

Hey! Thanks so much for your interest in Inertia.js and for submitting this contribution.

In an attempt to get on top of the issues and pull requests on this project I am going through all the older issues and PRs and closing them, as there's a decent chance that they have since been resolved or are simply not relevant any longer. My hope is that with a "clean slate" me and the other project maintainers will be able to better keep on top of issues and PRs moving forward.

Of course there's a chance that this PR is still relevant, and if that's the case feel free to re-submit it. If it's a new feature and not a bug fix maybe respond here first to make sure that it's something we want to include in the library.

Really not trying to be dismissive here, I just need to find a way to get this project back into a state that I am able to maintain it. Hope that makes sense! ❤️

reinink avatar Jul 28 '23 02:07 reinink