-
Notifications
You must be signed in to change notification settings - Fork 1.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
Shopify App Bridge context consumer for migrating off legacy React context APIs #457
Comments
@mbaumbach thanks for bringing this up. With v3.0.0 release coming soon we will look at making this change in v4.0.0. |
This issue has been inactive for 180 days and labeled with |
This will be part of polaris v4, though we also recommend using |
#1877 adds Though the recommended long term solution is to move onto using the components from app-bridge-react (which also uses modenr context). See their docks on the Provider component for how to setup their context provider |
Feature request summary
For current embedded apps trying to interact with the App Bridge, the suggestion is to use the legacy
static contextTypes
, as mentioned in the docs: https://polaris.shopify.com/components/structure/app-provider#section-access-to-the-shopify-app-bridge-instance. As of React 16.6,StrictMode
will now start warning that it's deprecated.This request is for a
Context.Consumer
or HOC (or other mechanism) that gives us access to the App Bridge through the now stable context APIs built in React 16.3 as well as the additionalstatic contextType
added in React 16.6 (https://reactjs.org/blog/2018/10/23/react-v-16-6.html#static-contexttype). Since there's already anAppProvider
that is required at the top level of Polaris apps, perhaps there just needs to be a correspondingAppContextConsumer
component that can wrap components needing access to the App Bridge.Rationale
The biggest benefit would be to better prepare Polaris, and all downstream consumers of Polaris, for future React releases as they deprecate the legacy context APIs.
The text was updated successfully, but these errors were encountered: