Losing saved state with complete with errors

Hello,

One can persist the state of the form to the local storage. This entry gets deleted when the user presses the Complete button. However… When an exception is thrown from the back-end the task loses all state and the entry in local storage is deleted nevertheless.

The only option I have that I can think of is to make all the tasks that follow-up my form tasks asynchronous but I don’t think that is a best practice.

I can understand some task handers might take some time but it would still be nice to have some sort of callback or just have some timeout information included in the saved state on which the tasklist can then decide to delete it when it is to old instead of removing it immediately. (could be parameterised in the variableManager object which takes care of the store action).

Kind regards,
Nico

Hi,

I’m not 100% sure to understand the second part of your post… but, for the first one, the idea would be to keep the (browser) local storage record until the response from server and then either:

  • delete the local storage record if the server successfully processed
  • keeps the local storage record if an error occurs on the server

And while displaying a form for which local storage data is found, display a confirmation message asking if the data should be restored (maybe with an indication of how old the data is). Right?

Cheers,
Vale

Hi Vale,

Yes this part is correct. This is how I see things work ideally.
For the second part, It would not be necessary for me to display a confirmation message prior to applying it.

The second part of my post was more an alternative solution for when the solution as you propose it would not be possible for any reason whatsoever.

Instead of deleting the data from local storage it should then be kept, but an expiration date should be added which is stored together with the stored values.

{
    "date": 1467013239896,
    "expirationdate": 1467013349896,
    "vars": {}
}

Then when fetching the variables for any form, all entries in local storage can be traversed that have key partial ‘camForm’ and the expiration date should be checked. If expired → delete at that point.

The default expirationdate could be a default of 2 weeks but should be possible to override via the camForm or variableManager instance.

I admin that it might not be ideal to traverse all local storage entries, but it would be better already than what is implemented now.

Kind regards,
Nico

OK.

For the first part, it can be considered as a bug (or a missing feature) in my opinion and I created a Jira issue for that.

I’m still unsure about the second part.

It would be rather easy to set in the function that loads the local storage data a test on expirationdate which would return the data if not yet expired or delete the local storage record otherwise.
But in terms of user interaction, I firmly believe that, by default, the user should be asked what to do with data which might be outdated.

Cheers!

Yes, I agree. It might be a good think to keep the end-user in charge of the deletion of their stale data. But it would require some additional work (like displaying this data in a pop-up, perhaps with a diff view).

Regards,
Nico

Hi again,

I just think about a message something like:

“Some locally saved data from <time ago> were found. Do you want to use them to fill the form?”

Diffs are pretty techy. I don’t think usual users of the Tasklist would understand them (unless they are presented “human friendly” fashion).

Anyways, might be a nice feature / improvement in terms of user experience and I will discuss that with the colleagues.

Cheers