-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(remix-dev): add support for handle
, links
& loader
to mdx
#3763
feat(remix-dev): add support for handle
, links
& loader
to mdx
#3763
Conversation
🦋 Changeset detectedLatest commit: cea4a3e The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi @TAGraves, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
9c91865
to
ae49f2a
Compare
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
handle
, links
& loader
to mdx
Co-authored-by: Michaël De Boey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
🤖 Hello there, We just published version Thanks! |
I wonder why is the entire export const loader = typeof attributes === "undefined" ? undefined : () => attributes; As I understand it, in Remix the 👇🏻 This is currently possible in Remix, but won't be after this PR: ---
meta:
title: Page with dynamic content
---
import { useLoaderData } from 'remix';
import { fetchSomeData } from ...
export const loader = async () => {
const data = await fetchSomeData();
return { data };
};
export function ComponentUsingData() {
const { data } = useLoaderData();
return <div>{data.whatever}</div>;
}
# This page has dynamic content
<ComponentUsingData /> |
For some reason I didn't realize that would actually work. We haven't pushed this out yet as a release so I'll fix this before that happens. |
Here's the fix: #3800 |
Actually. Thinking about it more... We already support |
Ok, so |
@kentcdodds Those approaches won't work for plain markdown files since they require the Here's a fairly simple thing we wanted to do in a layout route: take the It'd be cool if we could detect if the markdown defines its own handle or loader and avoid overriding them if so. I'd be happy to take a stab at that. |
@TAGraves, thanks for the offer. We're not planning on investing any further in our markdown/mdx support. Build-time compilation of content is not the best UX/DX and we have other priorities as well (even reviewing PRs takes time). That said I did just make a PR (#3801) to support the Here's what I suggest. Either:
We do have ideas of things we can do to more fully customize the build-time markdown/mdx experience, but that's further down the pipeline. |
Oh, also I want to say thank you for your contribution here @TAGraves. I just realized that I reverted your addition to the |
This adds a handle export, links export, and loader export to MDX routes, much like the existing meta and headers exports.
Closes: #2592, #2858
Testing Strategy:
I added a new integration test for mdx routes which covers the existing functionality (I believe this was uncovered before) as well as the newly added functionality.
I can see a couple different approaches for doing this. One option would be to just make the handle the frontmatter and omit the loader altogether. We could also structure the loader as: