You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[馃悶] Importing image as a component and passing it as a prop causes error in certain cases. "Error: Code(3): Only primitive and object literals can be serialized"
#5647
Open
linkfang opened this issue
Dec 28, 2023
· 0 comments
Doing:
The real use case is the same as this issue I opened, but this is a different bug so I opened a new one.
In the real use case, I have a list of cards with images on them and I would like to utilize Qwik image optimization so I need to import images as components and pass them in a card component. Preview use case here: https://linkfang-portfolio.vercel.app/web-apps/
Repro is simplified to just an element with a button.
Expect:
I expect the web app will run properly without crash.
Happening:
The web app will crash when I:
Import the image as a component
Pass it as a prop into another component (card component)
In card component, including an event handler that will change a boolean signal
In card component, put the image prop into a ternary
With all 4 conditions above, the app will crash.
In the repro,
Passing imported image component as prop won't cause an issue;
Using ternary with a non-imported image component won't cause the issue.
Using imported image component inside the desired component (not passing as a prop) in a ternary won't cause the issue.
Using imported image component and pass it as a prop and use it with ternary BUT without any event handler that will change the signal won't cause the issue.
Which component is affected?
Qwik Runtime
Describe the bug
Doing:
The real use case is the same as this issue I opened, but this is a different bug so I opened a new one.
In the real use case, I have a list of cards with images on them and I would like to utilize Qwik image optimization so I need to import images as components and pass them in a card component. Preview use case here: https://linkfang-portfolio.vercel.app/web-apps/
Repro is simplified to just an element with a button.
Expect:
I expect the web app will run properly without crash.
Happening:
The web app will crash when I:
With all 4 conditions above, the app will crash.
In the repro,
Reproduction
https://stackblitz.com/edit/qwik-starter-vif4tk?file=src%2Froutes%2Findex.tsx
Steps to reproduce
Open the repro link should automatically run
npm i & npm run dev
, when everything is up and running,line 70
, then the app will crash with error:System Info
Additional Information
No response
The text was updated successfully, but these errors were encountered: