-
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 (Storage): More base cleanup of existing hooks/props #91196
Plans (Storage): More base cleanup of existing hooks/props #91196
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
7a96eea
to
c4cc59d
Compare
dba734e
to
7548cbe
Compare
8c9192e
to
ff0ec2a
Compare
ff0ec2a
to
5cad5f0
Compare
5cad5f0
to
095a5c5
Compare
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 (~89 bytes removed 📉 [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 (~89 bytes removed 📉 [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. |
@@ -16,7 +20,7 @@ export const setSelectedStorageOptionForPlan = ( { | |||
planSlug, | |||
siteId, | |||
}: { | |||
addOnSlug: WPComStorageAddOnSlug; | |||
addOnSlug: WPComStorageAddOnSlug | WPComPlanStorageFeatureSlug; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think addOnSlug
should now be renamed now that the real type is reflected. It can either be the add-on slug or a feature slug. We didn't make this distinction previously and worked the code around it from the looks of it. This is now the "selected storage option slug"
cc @jeyip if you can confirm :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look later today 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're correct. In my original implementation, I had set up the selected storage option slice of state to only be meaningful if a 50GB or 100GB storage add-on was selected. Otherwise, I had used some false-y value to represent that no add-on was chosen and that the plan's default storage option was currently selected.
As time went on I introduced storage feature slugs as a possible selected storage option slug value. I honestly can't remember why I did so, because looking at the surrounding code, it seems that if we had continued to equate a false-y storage option to default storage instead of an add-on, things would've been fine as well 🤔
Either way, the type you've added does accurately reflect the "addOnSlug" property, and I agree that it should be renamed given that its possible slugs aren't solely add-ons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jeyip . It makes sense. The implementation evolved properly, meaning we do populate this variable with either the add-on/upgrade feature or the standard plan feature. The current changes aren't touching the implementation side. Just adjusting the tuypes a little.
It might just be a case of renaming to slug
. I'll revisit this in a follow-up.
Hi @chriskmnds. These changes are quite extensive and I assume will need thorough review / testing. I won't get to it today and may be AFK from next week on jury duty. 'May' be as jury duty is unpredictable and I might not be selected 🤷. Flagging this to avoid blocking. In my previous role we could re-select a random reviewer by commenting on a PR. I haven't come across that approach in Calypso. |
@chriskmnds Are you able to clarify the status of this PR, in terms of the 'TBD'? Are you planning further updates? The discussion above between you and @jeyip implies some shared experience with the 'add-ons' functionality. I don't have this context, so without clear testing instructions I'm not sure how to proceed with the review. |
Apologies @oswian . You are correct, there is a bit of context around these changes. I will run a few more basic tests and proceed to deploy. We can revert or revisit if any regressions prop up. |
eb9acdf
to
2115e2c
Compare
2115e2c
to
08acb55
Compare
Related to #90905
Based on #91050
Proposed Changes
Additional refactors across storage add-ons/options logic:
AddOns
data store apparently)storageAddOnsForPlan
)/src/components/storage
and expose a singleStorageFeature
component. This is now generic and wrapped by the element that the respective grid needs to render.useGetAvailableStorageOptions
touseAvailableStorageOptions
(no longer called in a loops)Why are these changes being made?
Fairly critical parts of the code that need to be guarded behind concrete types, abstractions, a more DRY layer.
TODO
/src/components/storage/styles.scss
Testing Instructions
Pre-merge Checklist