Skip to content
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

StartPageOptionsModal should not render if content was added to a page #54227

Closed
richtabor opened this issue Sep 6, 2023 · 4 comments · Fixed by #54245
Closed

StartPageOptionsModal should not render if content was added to a page #54227

richtabor opened this issue Sep 6, 2023 · 4 comments · Fixed by #54245
Assignees
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@richtabor
Copy link
Member

Currently the StartPageOptionsModal renders when you add a new post/page, but also when you remove all the content on a page. This makes for a disorienting experience, as a modal pops up out unexpectedly.

I think the modal should only render when creating a new page.

If any content has been added to the page, then removed, the StartPageOptionsModal should not render again.

If we want to still provide a mechanism for users to view the modal, we can add a snackbar notification "Choose a starter pattern." that renders in this scenario (after content has been added and the content is removed) which provides an action "View patterns" for viewing the starter patterns.

Current experience

I delete the last top-level block on my page and the modal pops up unexpectedly.

CleanShot.2023-09-06.at.14.01.26.mp4
@richtabor richtabor added [Type] Enhancement A suggestion for improvement. [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Sep 6, 2023
@richtabor richtabor added this to Polish Sep 6, 2023
@richtabor richtabor moved this to Needs development in Polish Sep 6, 2023
@richtabor
Copy link
Member Author

richtabor commented Sep 6, 2023

You can test the above using https://github.com/WordPress/twentytwentyfour. The theme will have a starter patterns added; so this will become more prevalent than it is today (where hardly any themes are leveraging this flow).

Related: WordPress/twentytwentyfour#209

@Mamaduka
Copy link
Member

Mamaduka commented Sep 6, 2023

Can you reproduce the bug without the Gutenberg plugin?

This is probably a regression after #53673. The modal state is now local to a StartPageOptionsModal component. It's rendered based on the shouldEnableModal condition; mounting/unmounting resets the local state.

I can also see a modal flash when updating an existing page without the content. Here's the Replay link: https://app.replay.io/recording/the-start-page-options-modal-flashes-when-updating-page--c1d0ebdb-4d57-41ef-8a88-41e433e9b52f

cc @jsnajdr

@annezazu annezazu added [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Sep 6, 2023
@jsnajdr
Copy link
Member

jsnajdr commented Sep 7, 2023

I can reproduce this even with #53673 reverted, the bug must have been there for a very long time.

The bug manifests in two ways:

  1. What @richtabor reports: if you have an existing saved page, and remove all blocks and also the title, the page becomes "unsaveable and with no content" -- a condition that triggers displaying the modal.
  2. What @Mamaduka found: if you have a page that has a title but no content, it's "saveable" -- this is a condition different from the first case. But when it's being saved, it becomes "unsaveable" (per the isEditedPostSaveable selector) while the save is in progress. Condition for the modal is satisfied -- flash!

We'll need to improve the condition to really match only pages that are brand new and empty.

@jsnajdr
Copy link
Member

jsnajdr commented Sep 7, 2023

Fixing in #54227 🙂 I'm looking forward to trying out the starter patterns in Twenty Twenty-Four 👍

@github-project-automation github-project-automation bot moved this from Needs development to Done in Polish Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants