-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Plans: Header price-discounting refactors #96492
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~112 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~112 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. 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. Generated by performance advisor bot at iscalypsofastyet.com. |
@jeyip still WIP and something to ship last. Let me know if you get a chance to review the code at least. The functionality should be the same. The changes circle around how we align the header price for a non-discounted plan in a grid with discounts e.g. the "Free" plan's price when term-savings are enabled or intro offers (like first-year currency) for the other plans. |
Thanks for tagging. I'll check this out, test, and review first thing tomorrow morning 👍 |
3511344
to
021e5d8
Compare
TestingRequirementsFor each of the flows listed below:
Flows:
Browsers
|
Updated the PR description with some testing instructions for posterity. Feel free to edit anything if it looks off 🙂 |
Thanks for outlining the evolution of the PR in distinct commits. Super helpful There's something that I'm not quite clear on -- would you mind explaining a bit more about the change between wrap header discounting logic in a hook and move it to header-price context? I think I'm missing something, because it seems like we could avoid the extra file and header price context provider by keeping the |
@jeyip thanks for reviewing!
One of the points was to eliminate side effects/knowledge stemming from the component traversing all the grid plans to determine if another header price is discounted. The hook method merely centralised the logic inside an internal hook, but it still needed all the extra knowledge to determine if something else (another instance of the component) has been discounted. With context (or the external store) the component simply "announces" that it has been discounted, and the rest can deal with that. That's the essence pretty much. It also reduces all the traversals happening on rerenders.
I think what you are missing is the component being rendered in a list. A local variable will be local to each instance. |
Ah yes that's it. Thanks for elaborating 👍
Going over this before I sign off tonight... 👀 Edit: Ahhh yeah I'm following. Thanks for explaining 🙂 |
9ece3ab
to
14945ae
Compare
There are some failing unit tests, but judging by the failures, they're simple reference errors. Things lgtm after those are addressed 🙂 |
f73ba06
to
c8e0442
Compare
3090e5f
to
32c9f83
Compare
This reverts commit 29abd6f.
c8e0442
to
d196100
Compare
Related to https://github.com/Automattic/martech/issues/3403
Proposed Changes
wpcom-plans-ui
wp-data storeuserEffect
hookWhy are these changes being made?
The goal is to (1) centralize the logic outlined above, (2) reduce processing, (3) avoid code duplication.
Testing Instructions
/plans/:site?flags=plans/term-savings-price-display
and/start/plans?flags=plans/term-savings-price-display
Pre-merge Checklist