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

@astrojs/markdoc v0.2.2: Markdoc tag rendering Astro component breaks when component uses getEntryBySlug() #7170

Closed
1 task
paulrudy opened this issue May 23, 2023 · 4 comments · Fixed by #7178
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: markdoc Related to the `@astrojs/markdoc` package (scope)

Comments

@paulrudy
Copy link
Contributor

What version of astro are you using?

2.5.3

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

Vercel

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome, Safari

Describe the Bug

This is a very particular bug that showed up with @astrojs/markdoc v0.2.2 , when all of the following are true:

  1. @astrojs/markdoc is v0.2.2
  2. Pages are served from a content collection of at least two .mdoc files.
  3. markdoc.config.mjs imports an Astro component (for the purpose of defining a tag, although no tag actually needs to be defined—or used in any .mdoc file)
  4. The Astro component uses getEntryBySlug() to access data from another content collection (the new getEntry() also produces the error)

The error looks like:

 error   Unexpected error while rendering pages → index.mdoc.
  File:
    /home/projects/github-pq3pgo/node_modules/astro/dist/content/runtime.js:186:33
  Code:
    185 |   renderEntryImport
    > 186 | }) {
          |                                 ^
      187 |   var _a, _b;
      188 |   const UnexpectedRenderError = new AstroError({
      189 |     ...AstroErrorData.UnknownContentCollectionError,

Pages render as expected after downgrading to v0.2.1, or when any of the other items above are false!

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-pq3pgo?file=markdoc.config.mjs

Participation

  • I am willing to submit a pull request for this issue.
@bholmesdev bholmesdev self-assigned this May 23, 2023
@bholmesdev bholmesdev added - P4: important Violate documented behavior or significantly impacts performance (priority) pkg: markdoc Related to the `@astrojs/markdoc` package (scope) labels May 23, 2023
@paulrudy
Copy link
Contributor Author

paulrudy commented Jun 6, 2023

@bholmesdev I hate to say it but unfortunately this issue has popped up again with v0.3.1. Should I create a new issue?

Here's a fork of the original repro, but with updated astro 2.6.0 and @astrojs/markdoc 0.3.1

@bholmesdev
Copy link
Contributor

Hey @paulrudy! That... hurts me deeply 😓 Is it present in 0.3.0 as well?

@paulrudy
Copy link
Contributor Author

paulrudy commented Jun 6, 2023

Hey @paulrudy! That... hurts me deeply 😓 Is it present in 0.3.0 as well?

So sorry! No, the bug is not present in 0.3.0

I went ahead and made a new issue, hope that's okay #7317

@bholmesdev
Copy link
Contributor

No prob! Really appreciate it, just bummed the un-revert reintroduced this bug. I'll track that, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: markdoc Related to the `@astrojs/markdoc` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants