ctrlaltdylan / shopify-nextjs-toolbox

A set of tools to authenticate NextJs apps with Shopify's OAuth handshake and AppBridge Session Tokens
161 stars 21 forks source link

getShopOrigin() causes infinite loop #12

Closed DaveMitten closed 3 years ago

DaveMitten commented 3 years ago

As title says.

  const shopOrigin = getShopOrigin();
  console.log({ shopOrigin });

All I do is call it like so. In a component.

It's not in a useEffect or lifecycle. It is in a standard "page".

Have I missed something?

PaulvdDool commented 3 years ago

To get the shop name I use useShopOrigin() instead of getShopOrigin(). Perhaps that works for you as well.

const shopName = useShopOrigin();