Skip to content
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

Portal Component #2436

Merged
merged 4 commits into from
May 29, 2020
Merged

Portal Component #2436

merged 4 commits into from
May 29, 2020

Conversation

supernova-at
Copy link
Contributor

@supernova-at supernova-at commented May 27, 2020

Description

This PR creates a new Portal component for rendering content into a DOM node that exists
outside of the DOM hierarchy of the parent / calling component.

The Portal component is a simple wrapper around React Portals that provides a default target if needed.

We had this functionality already actually but the component was called Modal and it lead to confusion, especially after we introduced the Dialog component which has a "modal" mode.

In order to preserve backwards compatibility, we kept the Modal component around for now. It exists as an alias for Portal. In Venia though, all instances of Modal have been replaced by Portal.

Another option we discussed was to have the Modal component compose the Dialog component and set its isModal prop to true. This may be a future improvement and is out of scope here.

Related Issue

Closes PWA-590.

Acceptance

Verification Stakeholders

@jimbo

Specification

Verification Steps

All of the places where the new Portal component is used should be checked for regressions.
Please check that the following places function correctly on desktop and on mobile:

  1. Filter Modal on the PDP
  2. Edit an Item on the Cart Page
  3. Edit Shipping Information on Checkout Page
  4. Edit Shipping Method on Checkout Page
  5. Edit Payment Information on Checkout Page

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have updated the documentation accordingly, if necessary.

@m2-community-project m2-community-project bot added this to Ready for Review in Pull Request Progress May 27, 2020
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented May 27, 2020

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: PWA-590.

Generated by 🚫 dangerJS against 607c8ae

@devops-pwa-codebuild
Copy link
Collaborator

devops-pwa-codebuild commented May 27, 2020

Performance Test Results

The following fails have been reported by WebpageTest. These numbers indicates a possible performance issue with the PR which requires further manual testing to validate.

https://pr-2436.pwa-venia.com : LH Performance Expected 0.85 Actual 0.58, LH Best Practices Expected 1 Actual 0.92
https://pr-2436.pwa-venia.com/venia-tops.html : LH Performance Expected 0.75 Actual 0.37, LH Best Practices Expected 1 Actual 0.92
https://pr-2436.pwa-venia.com/valeria-two-layer-tank.html : LH Performance Expected 0.8 Actual 0.5, LH Accessibility Expected 0.9 Actual 0.89, LH Best Practices Expected 1 Actual 0.92

jimbo
jimbo previously approved these changes May 27, 2020
@@ -1 +1,2 @@
export { default as Modal } from './modal';
// To keep backwards compatibility, Modal is an alias for Portal.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. Perhaps leave a deprecation notice or at least a TODO. I think Zetlen has some examples of deprecation notices in the codebase.

@m2-community-project m2-community-project bot moved this from Ready for Review to Reviewer Approved in Pull Request Progress May 27, 2020
@jimbo jimbo added the version: Minor This changeset includes functionality added in a backwards compatible manner. label May 27, 2020
jimbo
jimbo previously approved these changes May 28, 2020
export { default as Modal } from './modal';
// For now, Modal is an alias for Portal.
// This is deprecated behavior and may be changed in the future.
export { Portal as Modal } from '../Portal';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Modal was part of the last release so I don't think this would be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately Modal has been around for a while (at least 5.0.0), so we're not sure who may be using it. I'll be sure to bring this up in community sync.

@@ -1 +1,3 @@
export { default as Modal } from './modal';
// For now, Modal is an alias for Portal.
// This is deprecated behavior and may be changed in the future.
Copy link
Contributor

@sirugh sirugh May 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://jsdoc.app/tags-deprecated.html

Suggested change
// This is deprecated behavior and may be changed in the future.
/**
* @deprecated Going forward you should use the Portal component for which Modal is now an alias.
**/

@dpatil-magento dpatil-magento merged commit f225d23 into develop May 29, 2020
@dpatil-magento dpatil-magento deleted the supernova/590_portal branch May 29, 2020 16:59
@m2-community-project m2-community-project bot moved this from Review in Progress to Done in Pull Request Progress May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:venia-ui version: Minor This changeset includes functionality added in a backwards compatible manner.
Development

Successfully merging this pull request may close these issues.

None yet

7 participants