-
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
Add-Ons: Round dynamically generated add-on monthly price #95369
Add-Ons: Round dynamically generated add-on monthly price #95369
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~45 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 (~20 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. |
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 |
276f7af
to
c934240
Compare
Created a tracking issue to solve the underlying recalculation problem #95416. |
Related to #95370
Proposed Changes
Why are these changes being made?
Although memoized, it appears that add-on prices are unnecessarily recalculated dozens of
times when invoked as part of the
PlansFeaturesMain
component.When we format the cost before displaying it to the end user, the formatting library warns us
that it will round floats and their decimal values for smallest currency unit calculations. Because of the
unnecessary recalculations, this warning is repeated and floods the console.
The ideal answer is to trace the root cause of the recalculations and prevent them, but after
taking a cursory look, it seems as if this will require deeper investigation. Tracking issue for this here #95416
Because we always work with smallest currency units for add-ons, the currency formatter will always round our floats. To address the warnings, we explicitly round add-on monthly price floats ( something that was already happening in the library ) before feeding the formatter our data . This suppresses the warnings.
Testing Instructions
/start/plans
or/plans/{site_slug}
Pre-merge Checklist