-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
"TypeError: globalThis.astroAsset is undefined" and render broken when displaying images pulled from content collection inside hydrated Vue component #11042
Comments
You shouldn't use |
@matthewp makes sense. Then getting the content in astro file and passing to Vue component as props works: |
@cengique Just FYI, you can also pass an astro component to a |
Thanks @Trombach ! I think in this case we need to filter the content entries through controls in the Vue component. I assume we won't have access to do it if it's inside a pre-rendered slot? |
@cengique I'm not sure what exactly you're trying to do, but I guess you could filter entries before they get passed to the vue component. Btw, I saw that you typed your collection prop as Edit: and you might want to do the filter outside of vue anyway because you can do it directly on the |
Thanks @Trombach ! I'm actually trying to filter dynamically with a text input and dropdown selections, so I can't pre-filter the content. But, I finally got it to work on the original codebase!
Will check this out! |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Firefox and Chrome
Describe the Bug
Hi,
We've been working on constructing our first Astro+AgnosticUI+Vue site: https://tapggc.org/
Code here: https://github.com/TAP-GGC/tap-ws1-astro-agnosticui
We hit an issue when displaying images from content collection in a hydrated Vue component. We get a "TypeError: globalThis.astroAsset is undefined" in the browser console and more importantly the Vue component stops rendering in the dev version. In the build version, the component draws once (correctly and including the image) and then disappears (with the same error).
This only happens when the component is hydrated. I submitted a support request on Discord and I was told this may be a bug.
I created a blank Astro project from scratch to demonstrate the issue, but I'm also pasting the files here. Thanks in advance!
content/config.js
:content/posts/test.md
:testC.astro
:components/vue.vue
:What's the expected result?
No error and Vue continues rendering. Image shows for a short time but then the whole component disappears.
Link to Minimal Reproducible Example
https://github.com/cengique/astro-content-vue
Participation
The text was updated successfully, but these errors were encountered: