Skip to content
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

docs: useSchemaOrg() doesn't seem to be reactive? #30

Closed
michealroberts opened this issue Nov 12, 2022 · 2 comments
Closed

docs: useSchemaOrg() doesn't seem to be reactive? #30

michealroberts opened this issue Nov 12, 2022 · 2 comments

Comments

@michealroberts
Copy link

I'm wondering what the usage is for the useSchemaOrg because I can't seem to get a reactive change to occur.

A typical example of usage I have provided is the following:

import type { Ref } from 'vue'

import type { Product } from '@/types'

export const useProductJSONLD = (product: Ref<Product | undefined>) => {
  useSchemaOrg([
    defineProduct({
      name: computed(() => product.value?.title || ''),
      description: computed(() => product.value?.description || ''),
      sku: computed(() => product.value?.id || ''),
    })
  ]) 
}

However, the output seems to take from the default that looks to be provided in the head section of the nuxt.config.ts file:

Screenshot 2022-11-12 at 16 57 39

Would it help if the input was made to be a MaybeComputedRef type ... ? I would be happy to PR for this.

Caveat - I'm using the Nuxt 3 module.

@harlan-zw
Copy link
Collaborator

Hey @michealroberts

Thanks for the issue. Not too sure what's going on here for the reactivity not to work.

With the release of @vueuse/head I'll be able to improve the reactivity quite a bit, so will look into this in the next week or so

@harlan-zw
Copy link
Collaborator

With the v2 release, all reactivity issues should be resolved.

Let me know if you have any issues with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants