Closed jasong689 closed 3 months ago
It neither has a toast
property. It's impossible to show toast messages on routes rendered inside a Modal
with src
prop. By the way, there are even more properties missing.
Modal src has to communicate with the main app for all App Bridge features. Modal is just a presentation layer.
Modal src has to communicate with the main app for all App Bridge features. Modal is just a presentation layer.
If that's the case it sounds like the instance of app bridge rendered within Modal
should have the environment
set as well.
@jasong689 It's fixed.
@meecrobe you should be able to get a toast working from inside the Modal src with this code:
window.opener.shopify.toast.show('this is a toast')
And it also works for the ResourcePicker: window.opener.shopify.resourcePicker
Describe the bug
If you set the
src
ofModal
from@shopify/app-bridge-react
to another route within your embedded app, the AppBridge that is returned fromuseAppBridge
from that context has anundefined
value forshopify.environment
.To Reproduce
Steps to reproduce the behaviour:
In an embedded app using app bridge v4 and
@shopify/app-bridge-react
v4.1.1Modal
component from@shopify/app-bridge-react
in the root of the embedded appsrc
prop of theModal
to/
useAppBridge
hook from@shopify/app-bridge-react
to return an instance of app bridgeshopify.environment
shopify.environment
within the modal's iframe is undefinedIf applicable, add screenshots to help explain your problem.
Expected behaviour
The values for
shopify.environment
should be the same between the embedded app and the modal.Contextual information
Packages and versions
List the relevant packages you’re using, and their versions. For example:
@shopify/app-bridge-react
@4.1.1
Platform
Additional context
Add any other context about the problem here, such as your app’s configuration (Node, Next.js, Rails).