astro icon indicating copy to clipboard operation
astro copied to clipboard

🐛 BUG: `astro dev` Components used in MDX-Layout do not update on save

Open ChristianK43 opened this issue 3 years ago • 3 comments

What version of astro are you using?

1.0.0-rc.6

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

None

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

When using the MDX-Integration and import an Astro-Component in the MDX-Layout file, the values in the Component-Script of that Component do not get updated on save while running astro dev

Example: const test was changed from "a" to "b", but it's still outputting "a" example screenshot

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-1trqzs?file=README.md&on=stackblitz

Participation

  • [ ] I am willing to submit a pull request for this issue.

ChristianK43 avatar Aug 05 '22 21:08 ChristianK43

I investigated this a little bit and am totally stumped. There might be a race condition in the module graph not populating importers properly or we might not be crawling all the way up the importer graph to invalidate the correct modules.

natemoo-re avatar Aug 05 '22 22:08 natemoo-re

@natemoo-re you've probably already found out yourself, but this is not limited to the component-script, but affects the whole component.

ChristianK43 avatar Aug 09 '22 11:08 ChristianK43

I'm experiencing this too, I think, using Astro 1.0.0.

If I change my .mdx files back to .md everything works. Meaning, my changes are reflected in the browser upon save.

Otherwise, if I really want to use .mdx files, I'd have to perform some tedious painful drill of deleting or commenting out the component, make my changes, then comment back in the component. Not fun.

djmtype avatar Aug 09 '22 21:08 djmtype

@ChristianK43 @djmtype Looks like this may be resolved in the latest version of Astro (1.0.9) and MDX (0.10.1)! I have a working demo over here with that Dummy component you provided. Let me know if this works as expected for you when editing on the dev server.

https://stackblitz.com/edit/github-u9y6mb?file=src/components/Title.astro

bholmesdev avatar Aug 25 '22 21:08 bholmesdev

@ChristianK43 @djmtype Looks like this may be resolved in the latest version of Astro (1.0.9) and MDX (0.10.1)! I have a working demo over here with that Dummy component you provided. Let me know if this works as expected for you when editing on the dev server.

https://stackblitz.com/edit/github-u9y6mb?file=src/components/Title.astro

Just spent a frustrating hour trying to figure out why my pages weren't hotreloading, finally find this.

Works fine on the following versions, thanks!!

		"@astrojs/mdx": "^0.10.2",
		"astro": "^1.1.1",

Bobakanoosh avatar Aug 27 '22 22:08 Bobakanoosh

@Bobakanoosh glad to hear it! I'll close this thread first thing tomorrow if I don't see any follow-ups.

bholmesdev avatar Aug 29 '22 19:08 bholmesdev

Closing! I'll reopen if anything is discovered. Thanks y'all 🙏

bholmesdev avatar Aug 30 '22 19:08 bholmesdev