Hi Bernhard,
we ran into a Firefox-specific issue with RockFrontend LiveReload in a local DDEV / ProcessWire setup.
Observed behavior:
- only when logged in as a superuser/admin, because LiveReload is injected in that context
- in Firefox, navigating from one frontend page to another can appear to jump back to the previous page after about 1.5s
- example:
- start on
/video-courses/
- navigate to
/online-shop/
/online-shop/ loads
- shortly after,
/video-courses/ is loaded again
- Chromium did not show this behavior in the same environment
- Tracy showed no HTTP redirect, because this is client-side, not a server redirect
Firefox console output:
The connection to https://.../?rockfrontend-livereload=... was interrupted while the page was loading.
Error occurred in EventSource, reloading window.
Root cause:
- in
livereload.js, evtSource.onerror triggers window.location.reload() after 1500ms
- Firefox seems to interrupt or reconnect the SSE request more aggressively during navigation
- that turns a transient LiveReload stream error into a full page reload, which makes normal navigation look broken
There is also a second fragility:
- in
LiveReload::validSecret(), the secret is deleted on first successful validation
- if the SSE request reconnects, the reconnect can fail because the token is effectively one-shot
What fixed it for us locally:
- change
livereload.js so onerror retries the stream instead of reloading the whole page
- keep the LiveReload secret valid for its cache lifetime instead of deleting it on first successful validation
Why this seems reasonable:
- a dropped SSE connection should not force a page reload
EventSource already has reconnect semantics
- retrying the stream keeps LiveReload working without breaking navigation
- keeping the secret valid for its TTL makes reconnects less brittle
If this sounds reasonable, we can prepare a PR.
Hi Bernhard,
we ran into a Firefox-specific issue with RockFrontend LiveReload in a local DDEV / ProcessWire setup.
Observed behavior:
/video-courses//online-shop//online-shop/loads/video-courses/is loaded againFirefox console output:
The connection to https://.../?rockfrontend-livereload=... was interrupted while the page was loading.Error occurred in EventSource, reloading window.Root cause:
livereload.js,evtSource.onerrortriggerswindow.location.reload()after 1500msThere is also a second fragility:
LiveReload::validSecret(), the secret is deleted on first successful validationWhat fixed it for us locally:
livereload.jssoonerrorretries the stream instead of reloading the whole pageWhy this seems reasonable:
EventSourcealready has reconnect semanticsIf this sounds reasonable, we can prepare a PR.