Skip to content

feat(site): warn user if they leave the editor without publishing #12406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

Screen.Recording.2024-03-04.at.11.14.14.mov

Close #12360

@BrunoQuaresma BrunoQuaresma requested a review from a team March 4, 2024 14:17
@BrunoQuaresma BrunoQuaresma self-assigned this Mar 4, 2024
@BrunoQuaresma BrunoQuaresma requested review from code-asher and removed request for a team March 4, 2024 14:17
@BrunoQuaresma
Copy link
Collaborator Author

I'm not sure if there is a way to test this behavior 😞 but I'm open to learn it in case you know

@BrunoQuaresma
Copy link
Collaborator Author

BrunoQuaresma commented Mar 4, 2024

Unfortunately, Chrome and other browsers do not allow the script to change the warning message.

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change!

Yeah I thinking testing will be difficult. Maybe Playwright can do it, it has a way to interact with dialogs.

Can we make it work for the back buttons too? The one in the page and the browser back button. I am not entirely sure how though, maybe we have to somehow hook into React navigation?

Some of the tests are failing. It looks like they are trying to click on the build button but it is disabled, so it is probably the addition of && dirty that is breaking them, I guess it is not getting set to true when the tests make their changes.

@BrunoQuaresma
Copy link
Collaborator Author

@code-asher 100% I'm going to work on the suggestions.

@BrunoQuaresma BrunoQuaresma requested a review from code-asher March 5, 2024 13:06
@BrunoQuaresma
Copy link
Collaborator Author

@code-asher I'm considering not adding e2e tests to this flow since it is a "nice to have" feature. Wdyt?

@code-asher
Copy link
Member

I'm considering not adding e2e tests to this flow since it is a "nice to have" feature. Wdyt?

Sounds good to me, I am not even sure it would work anyway. 😅

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!! Works wonderfully.

@BrunoQuaresma BrunoQuaresma merged commit bc30c9c into main Mar 5, 2024
@BrunoQuaresma BrunoQuaresma deleted the bq/warn-unplished-changes branch March 5, 2024 19:55
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Warn users they will lose unpublished template changes
2 participants