question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firefox page-refresh-on-save doesn't work

See original GitHub issue

Hello! In playing with Fresh, I’ve found that the websocket connection fails in Firefox (Developer Edition, 105.0b6 (64-bit)) and that means that refresh-on-save doesn’t work. Both Chrome and Safari work on the same machine.

The console error says:

The connection to http://localhost:8000/_frsh/alive was interrupted while the page was loading. [refresh.js:1:79](http://localhost:8000/_frsh/refresh.js)

I tested this on a new install of Fresh, doing

  1. deno run -A -r https://fresh.deno.dev my-project
  2. Selecting n for tailwind, and y for VSCode
  3. Running deno task start

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:7
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
xxSkyycommented, Oct 29, 2022

I’ve got kinda temporary fix for it, for me it works great at least. in static folder add this file:

static/reloader.js

new EventSource("/_frsh/alive").addEventListener("error", (_err) => {
  setInterval(async () => {
    const response = await fetch("/_frsh/alive")

    if (response.status === 200) location.reload()
  }, 100)
})

then add this script it to your routes/_app.tsx (or create new one like mine, it’s like index.html in Vite)

import { Head, asset } from "$fresh/runtime.ts"
import { AppProps } from "$fresh/server.ts"

export default function App(props: AppProps) {
  return (
    <>
      <Head>
        <script src={asset('/reloader.js')} />
      </Head>
      <props.Component />
    </>
  )
}

It’s just detecting error caused by restart and then reload page when it’s available again, so overall same experience and even reload pages on manual restart. One cons is flooded console with failed requests if restart takes longer.

4reactions
lucacasonatocommented, Sep 6, 2022

Following FF bug is likely to be blamed: https://bugzilla.mozilla.org/show_bug.cgi?id=1706003. Firefox is not properly reconnecting EventSource on lost connection.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix preferences that won't save | Firefox Help
Refresh Firefox to fix the problem. The easiest way to solve this problem is to restore Firefox to its default state while saving...
Read more >
Firefox won't start, won't "refresh," and creating new profile ...
Using your file browser, open the Programs Folder on your computer. Windows: C:\Program Files C:\Program Files (x86). Mac: Open the " ...
Read more >
When I Use the Save Page As menu option, it no longer saves ...
I frequently save web pages to disk. The last 40 days or so, the page first fails to save. When I instruct Firefox...
Read more >
Refresh Firefox - reset add-ons and settings
A Refresh can fix many issues by restoring Firefox to its default state while saving essential information like bookmarks and passwords.
Read more >
Refresh didn't save bookmarks and other stuff - Mozilla Support
Firefox in the new profile should look like a factory fresh installation. Open the Troubleshooting Information page using either: "3-bar" menu ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found