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

Shopify App Bridge context consumer for migrating off legacy React context APIs #457

Closed
mbaumbach opened this issue Oct 24, 2018 · 4 comments
Milestone

Comments

@mbaumbach
Copy link
Contributor

mbaumbach commented Oct 24, 2018

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 additional static contextType added in React 16.6 (https://reactjs.org/blog/2018/10/23/react-v-16-6.html#static-contexttype). Since there's already an AppProvider that is required at the top level of Polaris apps, perhaps there just needs to be a corresponding AppContextConsumer 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.

@tmlayton
Copy link
Contributor

@mbaumbach thanks for bringing this up. With v3.0.0 release coming soon we will look at making this change in v4.0.0.

@tmlayton tmlayton added this to the v4.0.0 milestone Oct 24, 2018
@mbaumbach mbaumbach changed the title EASDK context consumer for migrating off legacy React context APIs Shopify App Bridge context consumer for migrating off legacy React context APIs Nov 9, 2018
@ghost
Copy link

ghost commented Jul 13, 2019

This issue has been inactive for 180 days and labeled with Icebox. It will be closed in 7 days if there is no further activity.

@ghost ghost added the Icebox label Jul 13, 2019
@BPScott BPScott removed the Icebox label Jul 14, 2019
@BPScott
Copy link
Member

BPScott commented Jul 14, 2019

This will be part of polaris v4, though we also recommend using @shopify/app-bridge-react instead of configuring AppProvider to setup app-bridge

@BPScott
Copy link
Member

BPScott commented Jul 30, 2019

#1877 adds AppBridgeContext as an export in v4 (which will hopefully have a final release in about 2 weeks time).

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

@BPScott BPScott closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants