Skip to content

feat: Come back on the filled form on task post fail - #350

Open
erwanMarmelab wants to merge 2 commits into
mainfrom
feat/come-back-on-the-filled-form-on-task-post-fail
Open

feat: Come back on the filled form on task post fail#350
erwanMarmelab wants to merge 2 commits into
mainfrom
feat/come-back-on-the-filled-form-on-task-post-fail

Conversation

@erwanMarmelab

Copy link
Copy Markdown
Contributor

Problem

When posting a task on destop from the contact view, the dialog closes immediately while the request is sent. If the request fails, an error message appears, but the user has to reopen the dialog and reenter the details, which are lost.

Solution

Reopen the dialog on error and prefill with the task info

How To Test

in your console write this:

const realFetch = window.fetch;
window.fetch = async (input, init) => {
  const url = typeof input === "string" ? input : input.url;
  if (init?.method === "POST" && url.includes("/rest/v1/tasks")) {
    await new Promise((r) => setTimeout(r, 5000));
    return new Response('{"message":"Boom"}', {
      status: 500,
      headers: { "Content-Type": "application/json" },
    });
  }
  return realFetch(input, init);
};

to rollback:

window.fetch = realFetch

Additional Checks

  • [ ] The documentation is up to date
  • [ ] Tested with fakerest provider (see related documentation)
  • Tested with Mobile resolution

Also, please make sure to read the contributing guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant