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

" Unknown chunk type " when trying to display data from api in .astro component #7923

Closed
1 task
lowzyyy opened this issue Aug 2, 2023 · 4 comments · Fixed by #8127
Closed
1 task

" Unknown chunk type " when trying to display data from api in .astro component #7923

lowzyyy opened this issue Aug 2, 2023 · 4 comments · Fixed by #8127
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@lowzyyy
Copy link

lowzyyy commented Aug 2, 2023

What version of astro are you using?

2,9,7

Are you using an SSR adapter? If so, which one?

vercel

What package manager are you using?

npm

What operating system are you using?

windows

What browser are you using?

firefox

Describe the Bug

Unknown chunk type: name_of_some_attribute

When i fetch some data from API and try to display it, it shows error of unknown chunk.
This error has different error message on lower version of the astro like: stringified is undefined. But if you update to the latest version it should say the same as i mentioned in the beginning

What's the expected result?

It should display the data correctly

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-s5cpjh?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 2, 2023
@natemoo-re natemoo-re added the - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) label Aug 2, 2023
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Aug 2, 2023
@natemoo-re
Copy link
Member

Pinging @bluwy for this regression

@bluwy bluwy self-assigned this Aug 3, 2023
@bluwy bluwy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) labels Aug 3, 2023
@bluwy
Copy link
Member

bluwy commented Aug 3, 2023

It doesn't seem to be a regression. The error happens in older versions, but the newer versions has a different error message.

@bluwy
Copy link
Member

bluwy commented Aug 3, 2023

The issue is that the data has the property type and internally we also used that to render things differently. A better fix is to have our renderer tag the internal objects to handle it differently, so userland data is rendered right.

But what would ultimately get rendered is an [object Object] and that isn't likely what you want. You can wrap it with a JSON.stringify before rendering instead.

@natemoo-re
Copy link
Member

Yeah seems like using Symbol.for('astro:type') would be a smart move.

natemoo-re added a commit that referenced this issue Aug 18, 2023
* fix(#7923): do not throw on user { type } object

* chore: remove unused type export

* chore: guess it wasn't unused
ematipico pushed a commit that referenced this issue Aug 21, 2023
* fix(#7923): do not throw on user { type } object

* chore: remove unused type export

* chore: guess it wasn't unused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants