-
-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
Related plugins
Description
As a developer using @vitejs/plugin-rsc, I want to be able to use React.cache in Server Components.
Right now, exporting React.cache
from a Server Component throws unsupported non async function
(via validateNonAsyncFunction()
).
I made a reproducer based on a react-router example here. It has two routes, both have identical code except for one route using React.cache.
Suggested solution
I tried disabling the throw new Error
-Part in both validateNonAsyncFunction
functions and the route using React.cache is rendering fine. So maybe it'll be sufficient to conditionally throw the error? 🤔
Alternative
No response
Additional context
I just want to express my appreciation of all the work being done here on bringing RSCs to Vite. Amazing! 🙏
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.