-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Stabilize UserLayout #309
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
Stabilize UserLayout #309
Conversation
|
This pull request is automatically deployed with Now. |
|
The additional declaration isn't making it through the compilation process. Since I tested this approach on already-compiled code it didn't have that issue when I tested originally. I've also since discovered that a couple of things rely on the raw MDX output, like the runtime, so this would require a bit more change than anticipated. |
|
This approach passes the tests but still needs to be expanded so that the same thing happens in the runtime as well. buble handles classes, so this should be straightforward and I plan to do it for this PR. |
|
This is looking great, thanks! We're definitely reaching a point where we might want to think about how to handle the MDX "templating" since it's starting to get pretty logic-filled. I wonder if we should just duplicate some of the output logic but have it handled differently based on whether |
|
I definitely agree that this templating is getting a bit hard to work with. I messed up a quote, etc here or there a couple times. I'll finish up the full conversion and then see how it looks, then change it if it still needs changing |
17d3050 to
dea8511
Compare
silvenon
left a comment
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.
Maybe an inline snapshot test would help, to verify that everything rendered correctly: .toMatchInlineSnapshot()
|
@silvenon I added a snapshot test with the other tests in |
|
I didn't realize there would be so much MDX content, it would be better if this was a regular snapshot, because it takes a lot of space. What do you mean by wrapped quotes? |
Can also use a smaller content. I re-used a fixture that already existed.
By wrapped quotes, I means this effect. Where there's a template string, then the string of code starts with double quotes leading to escaped doubled quotes all over the code. |
Yeah, maybe it's better if you just use a single
The string itself may not be pretty to look at, but try to mess up the output and see the diff when you run the test. If the diff is nice, that's all that matters. 😉 |
silvenon
left a comment
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.
Looks nice!
Fixes mdx-js#307 Pulls the layout for an MDX file into a reference that will be stable across renders. Previously, a layout defined in MDX content as an inline arrow function: ```js export default ({ children, ...props }) => <div {...props}>{children}</div> ``` would result in function defined inline in render, causing the reference to be created each time resulting in a remounting. This PR stablizes the reference by pulling the layout outside of render, resulting in no remount. try class approach works, but need to make it so that the runtime also has the fix
01a6371 to
3c2dc14
Compare
|
rebased. Only significant change was the additional prettier dep causing a conflict in mdx/package.json. Will squash/merge after tests pass. |
Fixes #307
Pulls the layout for an MDX file into a reference that will be stable
across renders. Previously, a layout defined in MDX content as an
inline arrow function:
would result in function defined inline in render, causing the
reference to be created each time resulting in a remounting.
This PR stablizes the reference by pulling the layout outside of
render, resulting in no remount.