-
Notifications
You must be signed in to change notification settings - Fork 2k
Dashboard: Replace decentralized feature functions with centralized object. #103793
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
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: App Entrypoints (~87055 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~6295 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 (~7652 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. |
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.
We've had some discussions here: pgz0xU-1q-p2. I'm okay with centralizing these functions in one place for now, and we can continue to iterate on it as we work toward a more comprehensive solution.
BTW, I’m not sure if /sites/utils
is the best place for this, since we might need to check features outside the context of /sites
as well.
I have it at the root |
You have probably discussed this elsewhere, but why not just map the site response object to contain these values? Why do you consider the approach of separate functions better? In my mind eventually the dashboard would have a common interface and consumers (.com, a4a, etc..) will have to map their API responses to that common interface. So for example if we can update PHP version, a site should have this info from the REST API. Unless I missing something. |
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.
Left some comments. I agree with the direction, because it's very easy currently to be inconsistent with hosting feature gating in individual features. For example, we all forgot that we need to check for plan expiration as well, not just whether a site is Atomic 🥲 see original logic in v1:
wp-calypso/client/sites/hosting/features.ts
Lines 9 to 14 in 5f1524c
export function areHostingFeaturesSupported( site?: SiteExcerptData | null ) { | |
const isAtomicSite = !! site?.is_wpcom_atomic || !! site?.is_wpcom_staging_site; | |
const isPlanExpired = site?.plan?.expired; | |
return isAtomicSite && ! isPlanExpired; | |
} |
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 |
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.
Looks good, we can keep improving how these work!
@ntsekouras: we had discussed this here: pgz0xU-1q-p2 We haven't agreed on a good way to organize this in the backend, so in the meantime we'll try to do it from the frontend side. |
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.
Looks good to me! We can continue to iterate this in the future 🙂
d78d12c
to
155b9e2
Compare
Proposed Changes
This presents an option for centralizing feature checks for sites.
Why are these changes being made?
We currently check the object directly like so
site.is_wpcom_atomic
.Since we don't have an agreed-upon strategy, we're starting to see local functions wrapping that call and being exported.
Example:
Testing Instructions
N/A
Pre-merge Checklist