-
-
Notifications
You must be signed in to change notification settings - Fork 865
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
Some plugins require async run #680
Comments
PR welcome! |
Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved. Is this something you can and want to work on? Team: please use the |
Also, probably a very bad idea to use a plugin that hasn’t been updated in 3 years... |
Haha... very true. I saw that the plugins were referenced on the list of plugins and still indicated they were "up to date". I guess that means different things to different people! 😆 I might take a stab at a PR, but maybe it's worth looking around to see if there are any newer plugins too. Thanks! |
Resolves remarkjs#680 Signed-off-by: Michael Irwin <[email protected]>
That indication means that it did not start crashing when remark introduced a breaking change two 2 years ago, which did affect some plugins.
Perhaps I can help you if I know what you are looking for? |
I like the idea of using the FWIW... it's been working great and I haven't run into issues yet beyond needing the processor to run asynchronously. But, if there are other plugins you think can meet this need, I'll be happy to switch! |
This is definitely a blocker for many scenarios and going to be a bigger one once react server components are more common and people would wanna put async code in plugins. |
Such as?
Why? I don’t see how RSC affects this issue. |
I am trying to build a remark plugin which requires async run and use it in react markdown. I am using this in a React Server Component If this was a client-side component, I would have called the plugin in a hook (as a standalone remark plugin) and loaded the result in the react markdown plugin when the result was complete, allowing me to run the code synchronously Since this is a server-side component, the result needs to be compiled on the server and I cannot use hooks or state. It would make things easier if the component (ReactMarkdown) itself is made asynchronous, allowing it to use
With RSC, more people are going to use ReactMarkdown to render markdown on server side instead of using other technologies because it integrates with their frontend well and it is easier to maintain it in a single codebase. In such cases, async plugins can potentially be more common. This is the exact same thing I am facing. I was previously rendering md on server side manually with some limited format options. Now I can just use ReactMarkdown with RSC |
Can you show this component?
Can you show docs on these async components that you are talking about? |
Here is the link to the RFC for React Server Components: https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md Read the example: https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md#basic-example Notice the difference between the first example (server component which is async) and the second example (client component)
The remark plugin I am building basically reads a link node in the markdown (mdast tree), then performs http requests on that URL to fetch some data. Based on that data, it changes the mdast subtree of that link node. So my plugin must run async. |
As I understand it, the RFC on async/await on the server is still open (reactjs/rfcs#229). I believe this is also what adds a |
This comment was marked as spam.
This comment was marked as spam.
Folks, you’re spamming. Come and help solve this issue (and the upstream React issue) or hush. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
@skyl first see the big note in the |
Here’s an idea: We add a new prop
Which async renderer to use, is determined using export conditions. |
I think that’s the idea floated around in #682 (comment) too? |
I see. I remember we talked about it, but I didn’t see it in this issue and didn’t realize the idea was posted in that PR. Is a PR welcome for that, or is more discussion needed? |
Yes, looking for someone to do the work and investigate whether it works or not. |
Initial checklist
Affected packages and versions
8.0.2
Link to runnable example
https://codesandbox.io/s/nice-austin-wrug0t
Steps to reproduce
remark-code-frontmatter
remark-code-extra
Expected behavior
The render still works.
Actual behavior
When using the
remark-code-frontmatter
andremark-code-extra
plugins, I'm getting the following error:Digging in, it looks like the
remark-code-extra
plugin is returning Promises, forcing the async flow.Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: