shopify icon indicating copy to clipboard operation
shopify copied to clipboard

Getfiltered and getContents do not exist in useContent composition API [Bug]:

Open sleepon-official opened this issue 2 years ago • 1 comments

Expected Behavior

According to in the document Sample code for:

import { onSSR } from '@vue-storefront/core';
import { useContent, contentGetters, useRoute } from '@vue-storefront/shopify';

export default {
  setup() {
    const route = useRoute();
    const { search, content } = useContent();
    const { slug } = route?.value?.params;

    onSSR(async () => {
      await search(slug);
    });

    const page = computed(() => contentGetters.getFiltered(content.value));

    return {
      page
    };
  }
};

The following functions should be performed according to the document prompts:

getFiltered - Retrieve the single page fetch by handle from Shopify store

getContents - Return the list of pages of Shopify store.

Actual Behavior

Unable to execute and error reported: export 'contentGetters' was not found in '@vue-storefront/shopify' Cannot read property 'getFiltered' of undefined

Possible Solution

Improve the getfiltered and getcontents methods mentioned in the document

Steps to reproduce

import { onSSR } from '@vue-storefront/core';
import { useContent, contentGetters, useRoute } from '@vue-storefront/shopify';

export default {
  setup() {
    const route = useRoute();
    const { search, content } = useContent();
    const { slug } = route?.value?.params;

    onSSR(async () => {
      await search(slug);
    });

    const page = computed(() => contentGetters.getFiltered(content.value));

    return {
      page
    };
  }
};

What version of shopify integration are you using?

1.1.2

What version of Node.js are you using?

14.17

What browser (and version) are you using?

Chrome v103.0.5060.114

What operating system (and version) are you using?

MacOs 11.6.5

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

sleepon-official avatar Jul 11 '22 09:07 sleepon-official

Faced the same bug.

Zavtramen avatar Jul 25 '22 07:07 Zavtramen