mljar/mercury

Prevent reload or refresh on disconnect

kapily opened this issue · 5 comments

Repro:

  1. Create a notebook
  2. Start the mercury server
  3. Open it in the viewer
  4. Terminate the mercury server. Now, the page becomes gray.
  5. Restart the mercury server

If you do this, you will get this error:

Network Error
Please check if you have internet connection and server is running. In case of problems, please contact administrator.

Can we have an option to prevent the graying out the page or network error when the server is unavailable?

Hi @kapily,

This behavior is on purpose. We detect problem with connection and display the error message. After server is up, user needs to refresh the web app to be back.

The gray notebook is to indicate that there is some waiting for server response (for example, waiting for results). User can't access notebook when it is gray. Right now I don't have better idea on how to indicate for user that we wait for server response. Any propositions?

My use-case sometimes I open up many links to notebooks in different tabs (loading the notebooks requires network calls and is slow so I run them in parallel), but then when I go back to open them, they have since refreshed because of either chrome blocking a network connection or an nginx timeout after the page had been loaded for a few minutes. This is a pain point because a page that took a bunch of network requests to load can't stay loaded for more than a few minutes.

Maybe we can just use the red-colored CPU on the bottom left of the page to indicate the page is unavailable? And maybe a CLI option that prevents the page from being reloaded?

Do you have any code pointers on what I could disable to prevent out the graying out and re-connecting?

Another possibility is an option to mr.App(...) to only refresh the page if the submit button is pressed.

The code that gray out the notebook is here

<BlockUi tag="div" blocking={!hideBlockUi && waiting}>

The code that display Network Error message:

} else if (siteStatus === SiteStatus.NetworkError) {
If you just comment out this if condition, it will display app view.

Another possibility is an option to mr.App(...) to only refresh the page if the submit button is pressed.

You can set continuous_update argument to update the web app only after Run button clicked https://runmercury.com/docs/input-widgets/app/