-
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
wpcom-proxy-request: Return Promise if no callback specified #39683
Conversation
dddfd73
to
93e07ed
Compare
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.
More notes and thoughts than you wanted on this smallish PR 🙂
I'm particularly concerned about sideEffects - that likely breaks some functionality completely.
Co-Authored-By: Jon Surrell <jon.surrell@automattic.com>
3945ba4
to
989506c
Compare
Thanks a lot for reviewing, Jon! Addressed all feedback, should be ready for another look! |
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 @ockham I just have a question about the calls to requestAllBlogsAccess()
added in 989506c. Are they just there for testing purposes?
Doesn't seem related to this PR, but this call is needed for the stores to work properly perhaps we need a way of coordinating the calls so we don't create a network storm during app boot.
No, this was supposed to stay as-is. That's the call that was previously run at module level in
Is there a high risk for that? |
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, I don't see any regressions. Thanks!
@@ -64,6 +64,3 @@ cached-requests.json | |||
/apps/*/dist/ | |||
/apps/*/types/ | |||
/packages/*/dist/ | |||
# Redundant after https://github.com/Automattic/wp-calypso/pull/39173 | |||
# Safe to remove after some time has passed | |||
/packages/*/types/ |
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.
👍 thanks!
requestAllBlogsAccess().catch( () => { | ||
throw new Error( 'Could not get all blog access.' ); | ||
} ); |
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.
It's worth noting that this is async, so we'll synchronously return the controls below, but may asynchronously error.
That seems alright to keep the happy path simple and failing fast.
🤦♂ ah so it was
I shouldn't have said "network storm", that was the wrong term. Calling |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~327 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. 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. |
Changes proposed in this Pull Request
The promise wrapper introduced by @andrewserong et al. in #38823 seems generic enough for it to make sense to have it in
wpcom-proxy-request
. This PR moves it there. This follows precedent set bywpcom.js
.Note that this is a technically a breaking change, as noted in the package's
History.md
:Testing instructions
Verify that Gutenboarding still works (esp account and site creation).