Coder Social home page Coder Social logo

🐛[Bug] about discount-app-components HOT 1 CLOSED

shopify avatar shopify commented on May 20, 2024
🐛[Bug]

from discount-app-components.

Comments (1)

knames avatar knames commented on May 20, 2024

Hi there, @Martin86Ec!

After replacing the <AppProvider> tag in Volumes/new.jsx with a <div> tag, the error stops.

I think the issue you are having is a result of having <AppProvider> in Volumes/new.jsx.

I followed along the steps from https://shopify.dev/apps/discounts/create up to the end of Step 2 and didn't see any issues.

You should have a DiscountProvider.jsx in frontend/components/providers

import { AppProvider } from '@shopify/discount-app-components'
import '@shopify/discount-app-components/build/esm/styles.css'
export function DiscountProvider({ children }) {
  return <AppProvider locale="en-US" ianaTimezone="America/Toronto">{children}</AppProvider>
}

as well as this line in frontend/components/providers/index.js after the other exports

export { DiscountProvider } from './DiscountProvider'

and then you should have

import {
  AppBridgeProvider,
  QueryProvider,
  PolarisProvider,
  DiscountProvider
} from "./components";

in frontend/App.jsx

and then you will want that provider you created to wrap the children there, so it might look like:

 return (
    <PolarisProvider>
      <BrowserRouter>
        <AppBridgeProvider>
          <DiscountProvider>  {/** here*/}
            <QueryProvider>
              <NavigationMenu
                navigationLinks={[
                  {
                    label: "Page name",
                    destination: "/pagename",
                  },
                ]}
              />
              <Routes pages={pages} />
            </QueryProvider>
          </DiscountProvider> {/** here*/}
        </AppBridgeProvider>
      </BrowserRouter>
    </PolarisProvider>
  );

Following step 2 in the Volumes/new.jsx will get you the new discount page, you shouldn't have any AppProviders in there. If you just copy the code from that page as is, it should display everything without issue.

I ran through this with the same npm/node/yarn versions as you and everything seemed to work.

Please feel free to reach out again if you have further issues!

from discount-app-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.