MDX content only rendered after refresh #38849
Labels
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
I'm considering replacing AsciiDoc with MDX in one of my production Gatsby sites. But before I commit I wanted to just figure out how it would work.
I have a small test site which works with
gatsby-plugin-mdx
version 3.20.0. It's using<MDXRenderer>
to render the MDX. The repository for the test site is here, Make sure that you are on the28-mdx
branch.However, I'd like to upgrade to a more recent version of the plugin. Having read the documentation I see that there is a major change at version 4.0.0. I applied the migration steps specified in the documentation. The resulting code can be found here. Make sure that you are on the
29-mdx-updated
branch.In
gatsby-node.js
I have the following:The site builds fine. But when I first visit the landing page the content from the MDX file (which should have been contained in
children
) is absent.However, if I make a minor edit to
src/pages/index.js
(which renders the landing page) then the site refreshes and the MDX content is suddenly visible.I have fiddled around with a bunch of things, but regardless of what I do the MDX content is not present until the site refreshes.
I have tried updating to the most recent version of the plugin with the same outcome.
The refresh behaviour is only apparent with the development server. If I make a production build then the MDX content is simply not there.
Reproduction Link
https://gitlab.com/datawookie/gatsby-whimsyweb/-/tree/29-mdx-updated?ref_type=heads
Steps to Reproduce
29-mdx-updated
branch.Expected Result
The landing page should include text from the MDX file: "MDX is a markup language that combines Markdown and JSX...".
Actual Result
This text is not present until I refresh the site (by simply editing a file so that the development server rebuilds).
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: