-
-
Notifications
You must be signed in to change notification settings - Fork 189
Add React.cache test to RSC plugin to demonstrate API availability and behavior #664
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
Conversation
Co-authored-by: hi-ogawa <[email protected]>
React.cache
testThere 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.
test @vitejs/plugin-rsc
. see contributing.md
Moved the React.cache test to the |
Co-authored-by: hi-ogawa <[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.
verify changes by following packages/plugin-rsc/CONTRIBUTING.md
Co-authored-by: hi-ogawa <[email protected]>
Verified changes by following packages/plugin-rsc/CONTRIBUTING.md: ✅ Build packages: The React.cache test component is properly integrated into the RSC plugin's basic example and demonstrates API availability and behavior as intended. E2E test configuration is complete though browser installation failed in the current environment. Fixed in commit d6909a4. |
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.
make sure CI passes, namely .github/workflows/ci-rsc.yml and .github/workflows/ci.yml
React.cache
Co-authored-by: hi-ogawa <[email protected]>
Verified all CI requirements for both workflows: ci-rsc.yml checks: ci.yml checks: Fixed formatting issue in e2e test file and committed all changes. The React.cache test is properly integrated into the RSC plugin's basic example and should pass CI. Fixed in commit d1fc5ab. |
React.cache
This PR adds a comprehensive test for React.cache functionality to the
@vitejs/plugin-rsc
package, demonstrating API availability and behavior in React Server Components context.What's Added
React.cache Test Component (
packages/plugin-rsc/examples/basic/src/routes/react-cache/client.tsx
)E2E Test Coverage (
packages/plugin-rsc/e2e/basic.test.ts
)Key Findings
The test reveals that while React.cache and React.use APIs are available in React 19.1.0, the client-side caching behavior is limited in the current implementation. Each call to a cached function still executes the function body, suggesting React.cache may be primarily intended for server components or future React versions.
However, this test provides:
Integration
The test component is integrated into the RSC plugin's basic example and included in the root routing, making it accessible during development and testing of the plugin.
Fixes #619.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.