Repository navigation
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]) DetailsCommon code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~4584 bytes removed 📉 [gzipped]) DetailsSections 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]) DetailsReact 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. |
DaniGuardiola
left a comment
There was a problem hiding this comment.
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.
| 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.
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.
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.
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.
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.
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
classnameswithclsxacross 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
@wordpresspackages in #91366.Testing Instructions