QwikDev / astro

Qwik + Astro integration
214 stars 13 forks source link

QWIK ERROR occurs when rendering Qwik components directly in MDX #63

Closed totto2727 closed 7 months ago

totto2727 commented 8 months ago

Overview

With official MDX extensions in place, deploying Qwik components directly in .mdx causes a QWIK ERROR (see below for details) on the development server. Drawing and building itself is possible, but the development server log is filled with errors, which is inconvenient.

Minimum environment reproduced

https://stackblitz.com/edit/withastro-astro-wyclcm?file=src%2Fpages%2Findex.mdx

Run npm run dev.

Supplementation

Error log

npm run dev

16:24:08 [watch] src/pages/index.mdx
QWIK ERROR Error: Internal assert, this is likely caused by a bug in Qwik: The Qwik Component was not invoked correctly
    at createAndLogError (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:113:52)
    at throwErrorAndStop (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:59:17)
    at assertNumber (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:156:5)
    at Object.QwikComponent (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:7291:5)
    at renderJSXVNode (/home/projects/withastro-astro-wyclcm/node_modules/astro/dist/runtime/server/jsx.js:118:41)
    at renderJSX (/home/projects/withastro-astro-wyclcm/node_modules/astro/dist/runtime/server/jsx.js:57:10)
    at renderJSXVNode (/home/projects/withastro-astro-wyclcm/node_modules/astro/dist/runtime/server/jsx.js:112:22)
16:24:08 [200] / 8ms

Related?

https://github.com/QwikDev/astro/issues/50

thejackshelton commented 8 months ago

Overview

With official MDX extensions in place, deploying Qwik components directly in .mdx causes a QWIK ERROR (see below for details) on the development server. Drawing and building itself is possible, but the development server log is filled with errors, which is inconvenient.

Minimum environment reproduced

https://stackblitz.com/edit/withastro-astro-wyclcm?file=src%2Fpages%2Findex.mdx

Run npm run dev.

Supplementation

  • If you implement the wrapper in a .astro file, the exception will not occur.

Error log

npm run dev

16:24:08 [watch] src/pages/index.mdx
QWIK ERROR Error: Internal assert, this is likely caused by a bug in Qwik: The Qwik Component was not invoked correctly
    at createAndLogError (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:113:52)
    at throwErrorAndStop (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:59:17)
    at assertNumber (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:156:5)
    at Object.QwikComponent (/home/projects/withastro-astro-wyclcm/node_modules/@builder.io/qwik/core.mjs:7291:5)
    at renderJSXVNode (/home/projects/withastro-astro-wyclcm/node_modules/astro/dist/runtime/server/jsx.js:118:41)
    at renderJSX (/home/projects/withastro-astro-wyclcm/node_modules/astro/dist/runtime/server/jsx.js:57:10)
    at renderJSXVNode (/home/projects/withastro-astro-wyclcm/node_modules/astro/dist/runtime/server/jsx.js:112:22)
16:24:08 [200] / 8ms

Related?

50

Hey, I have perused this issue a couple of times. For now, a workaround to suppress the error would be wrapping it in an Astro file before using it in the MDX.

Qwik v2 is soon to be released, which includes a major change in Qwik's serialization system and runtime, including a change to the vNodes, as a result I think it might be best to wait and see if this issue rears its head post v2.

If you have any leads let me know! I will have more time to improve the integration further later this week.

thejackshelton commented 7 months ago

Fixed in Astro v4.5