-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
enhancement: using useShopOrigin() after next JS router push #15
Comments
Looks like we're doing 2 different methods of redirecting. I'm following Shopify's AppBridge Redirect method here: https://shopify.dev/apps/tools/app-bridge/actions/navigation/redirect I was having issues keeping the URL in sync with the app, because NextJS isn't able to change the URL within the iframe'd AppBridge app. Are you using a custom |
Hi @ctrlaltdylan Thanks so much |
I'm curious about your approach, could you share a simple page component using it? One day I'd like to provide a |
Sure, here is a sample page
this approach loses the query params, so a |
Hey @ahmed-adly-khalil, I am using next/router and I basically attach the params every time I change a route, this works out for me. e.g.
A temporary hack but not much of a hassle for me to keep the Shopify params always available in the URL. |
@jonathangiardino Thanks so much also i'm thinking about the non-embedded app scenario, not sure which approach works best there ... maybe for non-embedded we should hide these URL params from the URL and keep it in the session object? not sure |
I am not sure @ahmed-adly-khalil but perhaps an idea would be rewrites, next js offers them via either next config or the new middleware. Check these out! :) https://nextjs.org/docs/api-reference/next/server |
Hello,
I'm having a minor issue with
useShopOrigin()
after redirecting between my app routes using next JS router push, for ex:router.push("/new-page");
after looking into the source code and knowing that
useShopOrigin
usewindow.location.search
means it depends on theshop
param in the app URL after successful authentication.I think this is fair assumption, I can simply maintain the shop and other params using next router push options as described here: https://nextjs.org/docs/api-reference/next/router
as an enhancement, it would be great if
useShopOrigin
to read the shop from the session token like howuseApi
worksThank you
The text was updated successfully, but these errors were encountered: