-
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 real-time comments to Reader full-post view #40396
Conversation
Amazing! What's lasagna? |
A backend |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Webpack Runtime (~77 bytes removed 📉 [gzipped])
Webpack runtime for loading modules. It is included in the HTML page as an inline script. Is downloaded and parsed every time the app is loaded. App Entrypoints (~12225 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~27675 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 (~39984 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. |
@hewsut cooooool |
|
||
{ showLabel && ( | ||
<span className="presence-button__label-status"> | ||
{ translate( 'Viewing', 'Viewing', { |
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.
ℹ️ This string doesn't exist elsewhere without a context (or with a different one). You can probably drop the context. If needed, you can use a translator comment instead to clarify meaning.
I am not sure why ICFY seems to report the app entry endpoint still +12 KB. Maybe I did the dynamic import wrong? Ready for eyes either way. |
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 believe a webpackChunkName
comment should ensure the dynamic phoenix
import is always included in a separate, async-loaded chunk. See https://webpack.js.org/guides/code-splitting/#dynamic-imports
@griffbrad I thought I had this nailed in 7277061 after your feedback but ICFY still seems to report +12 KB (in FWIW I think I see it coming down as a separate JS chunk now only in Reader: So I'm not sure what I'm missing again. |
@sgomes have you encountered this before? Bundle size on entry-main is inflated in ICFY but the dependency in question is being loaded async in dev tools. |
My guess is the wp-calypso/client/state/index.js Line 71 in 0a3aa22
Subsequent PRs built on top of this one #40720 #40854 show an increase since they add more code tied to that middleware.
I'm not quite sure how we can fix this, I guess we would need some kind of async middleware registration if we want to conditionally load the middleware code only when needed, I bet there is some kind of way of doing that in Calypso 🤷♂️ |
Excellent research, @unDemian! I agree with your assessment; the middleware appears to be at fault here. I don't think there is currently any example of an asynchronously-loaded middleware anywhere in Calypso, but it should be possible, at least in theory. In practice, there may need to be some changes to the state layer in order to allow for it 😕 Unfortunately, any middleware approach is prone to these sorts of issues, since it separates functionality from the place where it's used, and makes it available everywhere. I've been looking at similar issues with analytics (which has its own middleware), as I'm trying to avoid the whole thing being loaded every time, regardless of what's in use. Edit: I'm currently trying to analyse the bundles before/after this change to confirm the above findings and narrow in on the extra code being loaded. I'll post a new comment when I have this. |
export const socketConnected = () => ( { type: 'LASAGNA_SOCKET_CONNECTED' } ); | ||
export const socketDisconnected = () => ( { type: 'LASAGNA_SOCKET_DISCONNECTED' } ); |
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.
The action types are added to client/state/action-types
but plain strings are used here.
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.
That should be fixed in the next PR #40720
I guess having a "placeholder" middleware that allows dynamic add/remove would do the trick, something like https://github.com/pofigizm/redux-dynamic-middlewares maybe? |
Two questions (or three or four)!
|
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.
OK with merging now and circling back on the perf concerns, yes. Sergio and I are discussing more and he's graciously offered to help with the middleware perf. The overall approach seems solid.
Thanks all. I'm going to merge then whenever all these tests clear. Andrei has three or four right behind this that will improve immediately. |
We're getting our Calypso "sea legs" back under us. And very open to detailed integration input as this gets off the ground.
Changes proposed in this Pull Request
Testing instructions
You should see the Reader update real-time in all cases.