-
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
phpMyAdmin hosting card: migrate data getter to direct wpcom.req.post #60806
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~35 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~163 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. 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.
This looks good to me! Great cleanup! 🚀
I'd only add an error notice in the failure scenario. 🔔
Noting that this can't be fully tested due to the fact that it only works on wordpress.com
domain (it's a limitation of the endpoint by design, with security purposes). Let's keep an eye and re-test once it's on staging!
window.open( `https://wordpress.com/pma-login?token=${ token }` ); | ||
} | ||
} catch { | ||
// ignore errors |
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 it would be useful if we can just dispatch an error notice in this scenario.
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.
Notice added 👍 It's a very generic "could not open please try again" message because there's nothing that could be comprehensible or actionable for the user. The main goal is to say something instead of failing silently.
Does it really? I was able to test the feature completely on an Atomic site, even in development Calypso. It fetches a token from the REST endpoint and opens |
It's weird how you managed to test it! Looking at |
Now I see what's wrong: the server endpoint checks if the origin is in an approved list (
I was testing only in local dev server which is OK. But When doing a similar origin check at other places (e.g., OAuth code), we "normalize" the
before checking. The |
4efdcf1
to
8f9da7e
Compare
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7128962 Thank you @jsnajdr for including a screenshot in the description! This is really helpful for our translators. |
Translation for this Pull Request has now been finished. |
For an Atomic site, there is a
/hosting-config/:site
page available (accessible also from Settings > Hosting Configuration in sidebar) and it contains a card for opening phpMyAdmin:How the "Open phpMyAdmin" button works is that it first issues a POST request to
public-api
to retrieve a token, and then opens awordpress.com/pma-login?token
URL in a new window.It's the POST request this PR is migrating from a data getter to a simple
wpcom.req.post
request.How to test:
Verify that the flow I describe above works for an Atomic site: clicking the button should retrieve a token and open a phpMyAdmin for the site in a new tab.