OpenClinica / enketo-oc

OpenClinica's fork of the Enketo web forms monorepo
Apache License 2.0
0 stars 5 forks source link

Clearing Storage produces odd error message #81

Open Apotischman opened 2 years ago

Apotischman commented 2 years ago

Describe the bug When a user clicks "Clear Storage" and clicks "Delete All", the page refreshes with a cryptic error message

To Reproduce

  1. Cache an offline form
  2. Go offline
  3. Fill out a form and submit
  4. Click "Clear Storage"
  5. Click "Delete All"
  6. Notice the following error message appears

fetch

Expected behavior The user should be brought to a screen that says "This form is no longer available."

MartijnR commented 2 years ago

Something odd in the steps above. I would expect any 'Failed to fetch' error message to be shown after going back online first. I see this when following the steps (which is great):

Screen Shot 2022-05-10 at 1 44 04 PM

Also it may not be realistic for a user to clear storage whilst offline, because any submission problems would probably be seen whilst online.

I'm noticing that the form does not always refresh. This may only be the case if multiple Enketo offline-capable tabs were open. This is not the reported issue though.

Apotischman commented 2 years ago

I was just able to reproduce this on my phone when not connected. See my recent email with a URL to try out. I saved the link to the form entry page, went offline and tried accessing. I still get the fail to fetch message instead of "no internet"

MartijnR commented 2 years ago

I am now able to reproduce it. I had to turn off some dev settings related to Service Workers (i.e. the cached application). No need to submit a record first.

The cached app tries to load a form but fails to fetch it.

MartijnR commented 2 years ago

The user should be brought to a screen that says "This form is no longer available."

@Apotischman, this text string will be added to enketo/enketo-express and I'm trying to get it right before triggering translation update requests. You could override it in this fork, but it's nice if you don't have to.

I think "This form is no longer available" is confusing since this happens when the user is offline (and there may some other obscure conditions under which it occurs). We have a separate case for a form that is no longer available on the server (with its own message). I propose to use "Failed to download form" in this case. What do you think?

Apotischman commented 2 years ago

"Failed to download form" works for us. Thanks!