-
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
Data Stores: Migrate Analyzer store to createReduxStore()
#74414
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~324 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~109 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 (~321 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.
Appears to be working well 🚀
client/landing/stepper/stores.ts
Outdated
@@ -26,4 +26,4 @@ export const USER_STORE = User.register( { | |||
|
|||
export const AUTOMATED_ELIGIBILITY_STORE = AutomatedTransferEligibility.register(); | |||
|
|||
export const ANALYZER_STORE = Analyzer.register(); | |||
export const ANALYZER_STORE = Analyzer.store; |
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.
General thought for all Automattic data stores -- instead of this, should we just export the store object as Analyzer
?
Then, when we're using anything in automattic/data-stores, it becomes simpler to use:
// or export it as analyzerStore, which is a bit clearer and follows our naming conventions
import { Analyzer } from '@automattic/data-stires';
useSelect( select => select( Analyzer ) )
(potentially avoiding the need to re-export the store from client/landing/stepper/stores too)
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 for some stores we export additional modules and types, so it might be necessary to export some more on top of the store. For example:
wp-calypso/packages/data-stores/src/onboard/index.ts
Lines 13 to 15 in 9651d4a
export { SiteGoal, SiteIntent } from './constants'; | |
export * as utils from './utils'; | |
export * from './types'; |
Those are then re-exported by the @automattic/data-stores
package and reused somewhere.
I'd suggest approaching those in another PR, since they might require additional work, and I don't see that as something related to refactoring to createReduxStore()
.
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've removed the store export indirection in 1ce6df9
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.
Fair enough! 👍
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! 🚢
Proposed Changes
This PR migrates the Analyzer store to use
createReduxStore()
andregister()
instead ofregisterStore()
.Part of #74399. A follow-up to #73890.
Testing Instructions
/setup/site-setup/importLight?siteSlug=YOURSITE&flags=onboarding/import-light
whereYOURSITE
is the slug of one of your sites.Pre-merge Checklist