community-platform
community-platform copied to clipboard
[bug] window modal appears about unsaved changes after publishing Howto
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:
- Go to 'howto'
- Click on 'edit'
- Make changes to any section (eg: description)
- Click on publish
- Try and leave page by clicking 'view Howto' or another way
- 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.

Additional context Add any other context about the problem here.
Is this bug still active? I'd love to have a crack at it
Yes it's still there @kyle-skaxx, thanks for taking a look. I'll assign the issue to you.
@kyle-skaxx did you get to take a look at this one?
@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.
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.
I am currently in the process of reading the final-form docs to come up with a proper solution.
Awesome, thanks @kyle-skaxx and don't worry I completely understand about life getting hectic!
✋
: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: