-
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
Dependencies: Replace classnames with clsx - v2 #91408
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: App Entrypoints (~488 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~4584 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 (~1924 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. |
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.
LGTM! Due to the large amount of changes, and to GitHub being annoying and not loading diffs past certain amount of files, I couldn't review every single file properly. I did review every package.json file and most of the ones that GitHub did load.
I did look for more instances of the cx
name, you'll find comments on them.
@@ -7,7 +7,7 @@ import { useMediaQuery } from '@wordpress/compose'; | |||
import { useDispatch, useSelect } from '@wordpress/data'; | |||
import { useCallback, useEffect, useState } from '@wordpress/element'; | |||
import { registerPlugin } from '@wordpress/plugins'; | |||
import cx from 'classnames'; | |||
import cx from 'clsx'; |
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.
Can we rename to clsx for consistency?
@@ -1,7 +1,7 @@ | |||
import config from '@automattic/calypso-config'; | |||
import { Button, Gridicon } from '@automattic/components'; | |||
import styled from '@emotion/styled'; | |||
import cx from 'classnames'; | |||
import cx from 'clsx'; |
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.
Same as other comment. We could rename to clsx for consistency.
@@ -2,7 +2,7 @@ | |||
import './styles.scss'; | |||
import { getDesignPreviewUrl } from '@automattic/design-picker'; | |||
import { MShotsImage, MShotsOptions } from '@automattic/onboarding'; | |||
import cx from 'classnames'; | |||
import cx from 'clsx'; |
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.
Same as other comment. We could rename to clsx for consistency.
@@ -2,7 +2,7 @@ | |||
import { useFocusTrap } from '@automattic/tour-kit'; | |||
import { __ } from '@wordpress/i18n'; | |||
import { globe, Icon, chevronUp, chevronDown } from '@wordpress/icons'; | |||
import cx from 'classnames'; | |||
import cx from 'clsx'; |
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.
Same as other comment. We could rename to clsx for consistency.
@@ -1,5 +1,5 @@ | |||
import { __ } from '@wordpress/i18n'; | |||
import cx from 'classnames'; | |||
import cx from 'clsx'; |
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.
Same as other comment. We could rename to clsx for consistency.
Thanks @DaniGuardiola 🙌 I'll follow-up with the rename in another PR - this PR is already huge as it is. |
@DaniGuardiola #91413 is a follow-up PR to address your feedback from above. |
Proposed Changes
This PR replaces
classnames
withclsx
across Calypso, which is a faster and lighter alternative. (v1 was #89843 but it was quite stale).@DaniGuardiola introduced it in Gutenberg in WordPress/gutenberg#61138 recently.
We can now replace it since we updated to the latest
@wordpress
packages in #91366.Testing Instructions