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

Site Assembler: ensure only one snackbar notice is shown per unique action #78421

Merged
merged 4 commits into from
Jun 22, 2023

Conversation

fushar
Copy link
Contributor

@fushar fushar commented Jun 20, 2023

Fixes:

Proposed Changes

Currently, each action (add/replace/remove) in the pattern inserter in the Site Assembler flow triggers a snackbar notice in the bottom-right corner of the preview panel on the right. When we do many actions in a short time interval (e.g. trying out headers), this will generate noisy notices and somewhat block the preview.

This PR fixes this problem by only showing one notice per action (add/replace/remove). This is done by assigning the action itself as the ID of the notice, so that we can first remove the previous notice with the same ID before creating a new one.

Testing Instructions

  1. Go to /setup/with-theme-assembler/patternAssembler?siteSlug=<site slug>.
  2. Try inserting and replacing header/footer many times; make sure that only one Block pattern ... replaced notice is shown.
  3. Try inserting and removing homepage patterns many times; make sure that only one Block pattern ... added / Block pattern ... removed` notice is shown (for each add/remove).

Illustrative videos:

Before After
Screen.Capture.on.2023-06-20.at.15-20-41.mp4
Screen.Capture.on.2023-06-20.at.14-52-01.mp4

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@fushar fushar requested a review from a team June 20, 2023 08:32
@fushar fushar self-assigned this Jun 20, 2023
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 20, 2023
@github-actions
Copy link

github-actions bot commented Jun 20, 2023

@matticbot
Copy link
Contributor

matticbot commented Jun 20, 2023

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~350 bytes removed 📉 [gzipped])

name                    parsed_size           gzip_size
pattern-assembler-step      -1268 B  (-0.1%)     -350 B  (-0.1%)
import-flow                 -1268 B  (-0.1%)     -350 B  (-0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@fushar fushar force-pushed the site-assembler/unique-snackbar branch from 699c045 to fd4151c Compare June 21, 2023 04:36
@miksansegundo miksansegundo self-requested a review June 21, 2023 06:09
Copy link
Contributor

@miksansegundo miksansegundo left a comment

Choose a reason for hiding this comment

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

The UX LGTM 👍

Screen.Recording.2566-06-21.at.13.09.09.mov

Copy link
Contributor

@arthur791004 arthur791004 left a comment

Choose a reason for hiding this comment

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

Tested and looks good to me 🎉

@miksansegundo
Copy link
Contributor

@fushar, tested again and looks ready to ship 👍

Screen.Recording.2566-06-22.at.16.20.02.mov

Some friendly reminders:

  • we mark all the boxes from the Pre-merge Checklist, even if they are not done but to acknowledge that they are not required.
  • after shipped, add it to Marvel Ship Table

@fushar fushar merged commit beeef9b into trunk Jun 22, 2023
@fushar fushar deleted the site-assembler/unique-snackbar branch June 22, 2023 09:46
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 22, 2023
@fushar
Copy link
Contributor Author

fushar commented Jun 22, 2023

@miksansegundo Thanks for testing it again and the reminders 😄 shipping... 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants