Open mahdi-akbary opened 1 year ago
The issue happens when you have your app opened on url: https://admin.shopify.com/store/somestore/apps/someapp. If you use legacy older app that forces legacy domain, it works fine: https://somestore.myshopify.com/admin/apps/someapp?force_legacy_domain=1.
In short, yes, the issue is happening on the first case. Basically it doubles part of url unnecessary, making the whole url invalid., e.g.: https://admin.shopify.com/store/somestore/store/somestore/charges/111111/RecurringApplicationCharge/confirm_recurring_application_charge?signature=signaturecode
It doubled: "store/somestore/store/somestore"
Having the same issue - "/store/somestore/store/somestore" instead of just "/store/somestore"
Versions:
@shopify/app-bridge@3.7.8
@shopify/app-bridge-react@3.7.8
@shopify/polaris@11.2.2
This only happens when using the useNavigate()
hook. If using App Bridge directly it works fine:
import { useAppBridge, useNavigate } from '@shopify/app-bridge-react';
import { Redirect } from '@shopify/app-bridge/actions';
// This doesn't work
const navigate = useNavigate();
navigate(billingUrl);
// This works
const app = useAppBridge();
const redirect = Redirect.create(app);
redirect.dispatch(Redirect.Action.REMOTE, billingUrl);
Thanks, @matomesc, That's correct! As of now, the only workaround is to use the plain JS redirection suggested in Shopify docs: https://shopify.dev/docs/apps/tools/app-bridge/actions/navigation/redirect-navigate#plain-javascript
import { Redirect } from '@shopify/app-bridge/actions';
.
.
.
const app = useAppBridge();
const redirect = Redirect.create(app);
redirect.dispatch(Redirect.Action.REMOTE, billingUrl);
Having the same issue - "/store/somestore/store/somestore" instead of just "/store/somestore"
Versions:
@shopify/app-bridge@3.7.8 @shopify/app-bridge-react@3.7.8 @shopify/polaris@11.2.2
This only happens when using the
useNavigate()
hook. If using App Bridge directly it works fine:import { useAppBridge, useNavigate } from '@shopify/app-bridge-react'; import { Redirect } from '@shopify/app-bridge/actions'; // This doesn't work const navigate = useNavigate(); navigate(billingUrl); // This works const app = useAppBridge(); const redirect = Redirect.create(app); redirect.dispatch(Redirect.Action.REMOTE, billingUrl);
Describe the bug
I send the redirect URL for billing from my server to the frontend of my app which uses Shopify React components and is based on Shopify Starter node project.
To Reproduce
Steps to reproduce the behaviour:
If applicable, add screenshots to help explain your problem.
Expected behaviour
the navigate() should redirect and should not change the URL.
Contextual information
Packages and versions
List the relevant packages you’re using, and their versions. For example:
@shopify/app-bridge
@3.1.0
@shopify/app-bridge-react
@3.1.0
@shopify/polaris
@10.42.0
Platform
Additional context
Add any other context about the problem here, such as your app’s configuration (Node, Next.js, Rails).