inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Fast form updates causing a "SecurityError: Attempt to use history.replaceState() more than 100" in Safari

Open duswie opened this issue 11 months ago • 0 comments

Version:

  • @inertiajs/vue3 version: 1.0.11
  • Safari 17.2.1 on macOS 14.2.1

Describe the problem:

Fast updates of data within a remembered form created with useFrom('key, ...) are causing a Unhandled Promise Rejection: SecurityError: Attempt to use history.replaceState() more than 100 times per 10 seconds error.

Such quick updates can be made, for example, when using RangeSlider as user input. This can of course be prevented by a rate limit before changing the form value, but I think limiting the history.replaceState() calls to avoid browser errors should be a be handled by inertia?

Seems to be limited to Safari, tested with Version 17.2.1 on macOS 14.2.1.

Steps to reproduce:

  • use Safari
  • create a form with const form = useFrom('remember_key', { fast_changing: 0 })
  • change a value in the form more than 100 times per 10 seconds, like:
setInterval(() => {
  form.fast_changing = (new Date()).getMilliseconds()
}, 5)
  • check console for Unhandled Promise Rejection: SecurityError: Attempt to use history.replaceState() more than 100 times per 10 seconds

duswie avatar Feb 28 '24 22:02 duswie