-
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/guard installation flow #58493
Add/guard installation flow #58493
Conversation
Still need to clean up local state (nested ternary) and translation
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-21288 |
When displaying the error pages, there's a @cpapazoglou @WBerredo any ideas why it's needed or if we can remove it perhaps? |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~2336 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 (~101 bytes added 📈 [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. |
I suppose it was developed that it appears vertically centered? Probably we can make it better by utilizing |
As we're handling multiple types of errors now in this component, I've tried consolidating the error handling with the help of an enum, but ran into some race condition issues down the line. I see we're checking some conditions in an async way here: wp-calypso/client/my-sites/marketplace/pages/marketplace-plugin-upload-status/index.tsx Line 98 in 0d38fdc
@WBerredo could you help me with why the callback is needed here? Do we have some piece of state that changes on page load? Thanks 🙂 |
This wp-calypso/client/my-sites/marketplace/pages/marketplace-plugin-upload-status/index.tsx Lines 96 to 102 in 0d38fdc
On the upgrade and install flow, the plan we receive on the first render is the old/low tier plan, but this plan gets updated on the subsequent renders. That's why we wait 2 seconds before showing the error, and we consider if it didn't get updated in 2 seconds this is the current plan of the user. Does that makes sense? There is anything that still needs explaining? |
@WBerredo I thought that we can't use the data that we have on the initial render, but wasn't sure, thanks for clarifying! 🎉 |
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 was able to test the general path, but I would like to point two things:
- I didn't get the "upgrade to business plan" error, when following the steps I got the "direct access" error.
- Shouldn't we store which plugin triggered the install and check it on the state? Otherwise, I would be able to trigger an install and access the direct URL with another plugin installation if done at the same time.
Thanks for testing this @WBerredo, it'd be a great idea to add the plugin to the state! I'll check the issue with the errors and add this additional check. 🙂 |
I've added these changes and updated the test instructions with steps for the plugin upload flow. When trying to visit the install page directly on https://wordpress.com/plugins/upload/[DOMAIN], we're now showing a flow-specific error message that helps the user navigate back to the plugin upload page.
This was a small mistake on my side, I've accidentally copied over the other error message. 😄 I've fixed it now, it should work as per the test instructions. 👍 |
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 am seeing an error on the upgrade and install flow, if I complete the purchase or not I am always getting the "This URL should not be accessed directly. Please click the Install button on the plugin page." error.
I'm not sure if this is related to the environment it is created on the PR. But I think this worth some research.
`pluginInstallationStatus` could be overwritten by other actions
I've looked into this, and found that previously, the wp-calypso/client/my-sites/plugins/plugin-details.jsx Lines 444 to 451 in 91a7d3b
wp-calypso/client/state/marketplace/purchase-flow/reducer.ts Lines 34 to 38 in a184952
I've updated the installation check to still validate the wp-calypso/client/my-sites/marketplace/pages/marketplace-plugin-upload-status/index.tsx Line 82 in a184952
wp-calypso/client/my-sites/marketplace/pages/marketplace-plugin-upload-status/index.tsx Line 87 in a184952
|
With @WBerredo we've discovered a new edge case. When the user navigates away from the checkout page by changing the URL in the browser, the IndexedDB state is reset to the However, when the user navigates away from the checkout page by clicking the X icon in the upper left corner of the checkout page, the IndexedDB state is persisted as expected: It seems that by navigating to a new URL, the Redux init clears the persisted state instead of loading the values from IndexedDB, and hence breaks the purchase flow. When navigating through client routes, the We've tried removing the It seems that we won't be able to persist state between URL hops by utilizing IndexedDB. For the time being, I've updated the testing steps to clarify that the feature only works when navigating via UI elements. |
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.
Tested the last version and it is all working good 🚀
PS: The only edge case I found is mentioned at this PR but I don't think we can do anything about it.
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7024500 Thank you @gcsecsey for including a screenshot in the description! This is really helpful for our translators. |
* [WIP] add state var when installing plugins from the UI * [WIP] prevent plugin installation if the URL is visited directly Still need to clean up local state (nested ternary) and translation * [WIP] update error handling * [WIP] fail early when loading the URL directly * center error message vertically * update error handling * unset state var when plugin installation is complete * fix error handling * verify plugins slug and domain name when installing plugin from URL * fix plan upgrade error message * delete unnecessary whitespace * guard plugin upload flow too * add new error message to plugin upload flow * verify only `primaryDomain` and `productSlug` when installing plugins `pluginInstallationStatus` could be overwritten by other actions * evaluate error causes in priority order
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
A
was installed previously, it still prevents the installation of pluginB
from the URL directlyTesting instructions
Marketplace flow
Prevents direct access
/marketplace/<pluginname>/install/<siteURL>
Allows install after
Install
button click/plugins/<pluginname>/<siteURL>
Install
orUpgrade and Install
buttonThrows incorrect plan error message correctly
/plugins/<pluginname>/<siteURL>
Upgrade and Install
buttonPrevents direct access after a successful plugin install
/plugins/<pluginname>/<siteURL>
Install
orUpgrade and Install
button/marketplace/<secondpluginname>/install/<siteURL>
Plugin upload flow
Prevents direct access
/marketplace/install/<siteURL>
Allows install after plugin upload
/plugins/upload/<siteURL>
Fixes #58297