-
-
Notifications
You must be signed in to change notification settings - Fork 638
Add AsyncPropManager to react-on-rails-pro package #2049
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
Add AsyncPropManager to react-on-rails-pro package #2049
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review: Add AsyncPropManager to react-on-rails-pro packageThank you for this contribution! I've reviewed the PR and have identified several issues that need to be addressed before merging. 🚨 Critical Issues1. Typo in Error Message (packages/react-on-rails-pro/src/AsyncPropsManager.ts:89)There's a typo in the error message: `The async prop "${propName}" is not received. Esnure to send the async prop from ruby side`Should be: 2. Missing Implementation of
|
Code Review for PR #2049: Add AsyncPropManager to react-on-rails-pro packageSummaryThis PR introduces an Issues Found🔴 Critical Issues1. Typo in Error Message (AsyncPropsManager.ts:93)"Esnure to send the async prop from ruby side"Issue: "Esnure" should be "Ensure" Impact: User-facing error message has a spelling mistake. 2. Missing
|
Code ReviewOverviewThis PR adds an AsyncPropsManager to handle asynchronous prop delivery in React Server Components for the Pro package. The implementation looks solid overall with good test coverage, but there are several issues that should be addressed before merging. Critical Issues1. Typo in Error Message 🐛// packages/react-on-rails-pro/src/AsyncPropsManager.ts:92
return new Error(
`The async prop "${propName}" is not received. Esnure to send the async prop from ruby side`,
);Issue: "Esnure" should be "Ensure" Impact: User-facing error message contains a typo Fix: Change "Esnure" → "Ensure" 2. Debugging Code Left in Production 🚨// react_on_rails_pro/packages/node-renderer/src/worker.ts:325
log.info(`Received a new update chunk ${JSON.stringify(obj)}`);Issue: This debug logging should not be committed to the main codebase. It will:
Fix: Remove this line or make it conditional based on a debug flag 3. Incomplete Test Implementation
|
Code Review: AsyncPropsManager ImplementationI've reviewed PR #2049 which adds AsyncPropsManager to the react-on-rails-pro package. Here's my detailed feedback: 🎯 Overall AssessmentThis is a well-architected implementation of an async props management system. The code quality is generally high with good test coverage. However, there are several important issues that should be addressed before merging. 🐛 Critical Issues1. Typo in Error Message (AsyncPropsManager.ts:93)Change 'Esnure' to 'Ensure' in the error message. 2. Missing resolved Flag UpdateIn setProp, the resolved flag is never set to true. This could cause issues in endStream. Add: promiseController.resolved = true after calling resolve. 3. Memory Leak RiskThe propNameToPromiseController Map never clears resolved promises. In long-lived streams with many props, this could accumulate memory. Document the memory management strategy or consider cleanup. Test Coverage Issues4. Remove Console.log StatementsThe incrementalHtmlStreaming.test.ts has multiple console.log statements (lines 107, 116, 120) that should be removed. 5. Commented Test CodeLine 99 in incrementalHtmlStreaming.test.ts has a commented test. Either enable it or remove it. Design Concerns6. Log Level in Production CodeIn worker.ts:325, consider changing log.info to log.debug for the update chunk logging, as this could be noisy and JSON.stringify could be expensive. PR ChecklistBased on the PR template and CLAUDE.md:
What's Good
Before Merging - Must Fix
Great work overall! The implementation is solid, just needs these fixes before merging. |
Code Review for PR #2049: Add AsyncPropManager to react-on-rails-pro packageSummaryThis PR introduces an ✅ Strengths1. Excellent Test Coverage
2. Type Safety
3. Architecture
🔴 Critical Issues1. Typo in Error Message (
|
Code Review: AsyncPropsManager ImplementationStrengths
Critical Issues1. Typo (AsyncPropsManager.ts:93): Esnure should be Ensure 2. Missing resolved flag (AsyncPropsManager.ts:45): The resolved flag is NEVER set to true after resolving. This is critical because in endStream() even resolved promises might get rejected. Fix: Add promiseController.resolved = true before calling resolve. 3. Type validation bug (handleIncrementalRenderRequest.ts:52): Validation logic appears incorrect for onRequestClosedUpdateChunk. Type says string but validation checks for object. Other Issues
Missing per CLAUDE.md
Required Before Merge
Great architecture overall! Please address the critical resolved flag bug. |
d9c77fa
into
abanoubghadban/pro509/make-renderer-use-ndjson-for-communication
Summary
Remove this paragraph and provide a general description of the code changes in your pull
request... were there any bugs you had fixed? If so, mention them. If
these bugs have open GitHub issues, be sure to tag them here as well,
to keep the conversation linked together.
Pull Request checklist
Remove this line after checking all the items here. If the item is not applicable to the PR, both check it out and wrap it by
~.Add the CHANGELOG entry at the top of the file.
Other Information
Remove this paragraph and mention any other important and relevant information such as benchmarks.