Moving from App Bridge React to CDN is pretty straight forward and not as dauting of a task.
- Uninstall
@shopify/app-bridge
and@shopify/app-bridge-react
packages. This is being replaced by import AppBridge from Shopify's CDN inpages/_document.js
file. <NavigationMenu />
is now<ui-nav-menu>...</ui-nav-menu>
that takes a series of<a>...</a>
or for Next.js specifically,<Link>...</Link>
tags.AppBridgeProvider
is now just a check to see if theshop
exists. We do this to stop the base URL of our app be accessible without a shop.- There's no need to use
useNavigate()
orRedirect.app
anymore. Usingopen()
works as expected. You can see examples of this sprinkled throughout the debug cards and exitframe. - Using the new Resource Picker can come as a bit of a challenge. A great way to use it is to encapsulate the resource picker in an async funtion and instead of returning values, update your state variables to account in for the change. I'll be adding in an example for this in the future.
useFetch
hook got an update to be more reliable. We're now passing different headers that don't rely on Shopify/AppBridge to handle, making it more reliable. Your use ofuseFetch
hook doesn't change, just drop in the newuseFetch
hook and you're good to go./exitframe/[...shop].js
has reliability changes. You might want to update the components in there for better clarity on reauthorization process.- Legacy Polaris elements are replaced with newer ones.
verifyRequest
now checks for scope changes too. In dev mode, you might want to kill your dev server and restart for env to properly take effect, or you'll be stuck in an endless auth loop.pages/api/auth
have new changes. It's meant to be a drop in replacement so just replace your existing files with the new ones, and add in your changes.- Debug cards have been renamed and refreshed for better clarity and examples.