community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

[bug] window modal appears about unsaved changes after publishing Howto

Open AlfonsoGhislieri opened this issue 2 years ago • 5 comments

Describe the bug

A window modal appears prompting the user to confirm if they want to leave the page because there are unsaved changes. This should not be happening as the Howto is already uploaded and there should be no more unsaved changes on the page.

To Reproduce Steps to reproduce the behaviour:

  1. Go to 'howto'
  2. Click on 'edit'
  3. Make changes to any section (eg: description)
  4. Click on publish
  5. Try and leave page by clicking 'view Howto' or another way
  6. See error

Expected behaviour There should be no window modal appearing once the HowTo has been uploaded.

Screenshots If applicable, add screenshots to help explain your problem.

image

Additional context Add any other context about the problem here.

AlfonsoGhislieri avatar May 03 '23 22:05 AlfonsoGhislieri

Is this bug still active? I'd love to have a crack at it

kyle-skaxx avatar May 30 '23 09:05 kyle-skaxx

Yes it's still there @kyle-skaxx, thanks for taking a look. I'll assign the issue to you.

iSCJT avatar May 30 '23 10:05 iSCJT

@kyle-skaxx did you get to take a look at this one?

iSCJT avatar Jun 22 '23 11:06 iSCJT

@iSCJT Hey, yes I've taken a look at it and sorry for the inactivity life has been hectic as of late(nevertheless i am more than willing and able to contribute).

I noticed that the "Publish" and "Save to Draft" buttons in the Howto.form.tsx file appear to have the same onClick function assigned to them. As a result, when either button is clicked, it seems to trigger the same action.

image

Taking closer look at the trySubmitForm being passed, the form submission is triggered by dispatching a custom submit event on the formContainerRef element. This can lead to a scenario where the browser detects unsaved changes because the form state may not have been properly updated or cleared after the submission.

image

I am currently in the process of reading the final-form docs to come up with a proper solution.

kyle-skaxx avatar Jun 22 '23 13:06 kyle-skaxx

Awesome, thanks @kyle-skaxx and don't worry I completely understand about life getting hectic!

iSCJT avatar Jun 22 '23 14:06 iSCJT

benfurber avatar Jul 31 '23 14:07 benfurber

:tada: This issue has been resolved in version 1.86.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

onearmy-bot avatar Aug 04 '23 01:08 onearmy-bot