Shopify app keeps reloading after implementing GraphQL API call?

Shopify app keeps reloading after implementing GraphQL API call?


0

I’m learning full stack dev by making a Shopify app, the stack is Javascript, React, Remix, and uses the GraphQL API.
I’m consistently running into an issue with calling into the orders api call, the previously working web app will begin to repeatedly reload & then will fail with this error:

This app can’t load due to an issue with browser cookies. Try enabling cookies in your browser, switching to another browser, or contacting the developer to get support.

My guess is this is because there are repeated API calls that aren’t fully loading before the data changes (?).

However, when I revert the code to the previously working version, the web app no longer works as it did before. This is the part that’s super confusing to me…

This is how I’m calling into the orders api:

export async function loader({ request }) {
  const { admin } = await shopify.authenticate.admin(request);

  const response = await graphql(
        `
        query {
            orders(first: 10) {
                edges {
                  node {
                    id
                  }
                }
              }
            }
        `
    );

}

Why does this keep reloading? How can I fix this issue? And, on a higher level, I would greatly appreciate any links to documentation that show best practices for these api calls.

I’ve Googled around for why this happens/the proper way to call into this API, and haven’t found much useful information–though I’m sure I’ve missed the right places to look.

I’ve also successfully written small Shopify snippets that use different parts of the API (eg, products, etc.), and have used query and mutation api calls so far.

Thanks so much!

New contributor

sunny_chai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


Load 5 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *