Closed dargmuesli closed 6 months ago
This is a good solution to the issue but I'll need some time to think about if this is the best path forward.
Out of curiosity, can't you just call useSiteConfig
when you need to access the data instead of storing it?
Yes, that should work as well. It's just that I was very confused that useSiteConfig
does not provide a ref while most other Vue composables do. I spent quite a bit of time figuring out why the site config I use
d did not contain the description I updated it with.
And computed
does not like to have getter and setter of different types...
Ok, maybe a more understandable / real world use case would be:
updateSiteConfig({
description: siteDescriptionProp.value,
})
defineOgImage({
alt: ogImageAltProp.value,
component: ogImageComponentProp.value,
})
The og image would not have the description available right without this PR.
See the build logs here: https://github.com/dargmuesli/vio/pull/67
I think you have a valid issue that you're trying to solve in this PR, however, I don't think I can merge this as is as it would be a breaking change and I'd prefer to keep the existing API (it lets me expand it easier in the future).
I have made an issue to solve this at some point though: https://github.com/harlan-zw/nuxt-site-config/issues/11
Description
BREAKING:
useSiteConfig
now has avalue
getter & setter which allows to use it anytime and access up-to-date variables inside.Linked Issues
n/a
Additional context
See the test as an example for what's currently failing: using
site-config
, then updating it and checking for updates values through thesite-config
used before.