Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork13
Description
I used AI to group our TODOs, my idea is to review them here and, if necessary, create a specific issue to solve it. Let's use this space to discuss them. CC:@davesnx
TODO Issues - server-reason-react
This document contains all TODO comments found in the codebase, formatted as GitHub issues for better tracking and prioritization.
Issue#1: Promise Caching and Error Handling
Files:
packages/server-reason-react-ppx/server_reason_react_ppx.ml:545packages/reactDom/src/ReactServerDOM.ml:381packages/reactDom/test/test_RSC_model.ml:967
Description:
Implement promise caching functionality and improve promise error handling. There's a specific issue with promise failure handling that needs to be addressed.
Context:
There's commented-out code showing promise caching implementation forJs.Promise.t types. The implementation would cache promises to avoid re-executing them. Additionally, there are references to issue#251 regarding promise failure handling.
Acceptance Criteria:
- Determine when promise caching is needed
- Implement promise caching mechanism
- Review and fix issueClient value as props can fail and will reach the toplevel handler #251 (promise failure handling)
- Add configuration options for caching behavior
- Add tests for promise caching and error scenarios
- Implement the missing test for client components with promise failed props
🔧 React Server DOM Issues
Issue#3: Debug Information Improvements
Files:
packages/reactDom/src/ReactServerDOM.ml:153packages/reactDom/src/ReactServerDOM.ml:220packages/reactDom/src/ReactServerDOM.ml:221packages/reactDom/src/ReactServerDOM.ml:286packages/reactDom/src/ReactServerDOM.ml:311packages/reactDom/src/ReactServerDOM.ml:406packages/reactDom/src/ReactServerDOM.ml:556
Description:
Comprehensive improvements to debug information system including component info, stack traces, and error handling.
Context:
Multiple debug-related TODOs covering:
debugOwnershould be aReactComponentInfoinstead of string- Only
ReactComponentInfois implemented, missing other types from React Flight Server - Need to add props and stack information to debug info
- Stack info should be captured from both regular and async components
- Error digest should use UUID instead of hash
- Debug chunks might need specific ordering
Acceptance Criteria:
- Change debug owner from string to
ReactComponentInfo - Implement missing React Flight Server component info types
- Capture component props and stack traces in debug info
- Implement stack capture for regular and async components
- Replace hash-based digest with UUID
- Implement proper debug chunk ordering
- Update debug info serialization and tests
- Update documentation with debug capabilities
Issue#4: HTML Encoding and Security
Files:
Description:
Determine if we need to HTML encode the model or only the HTML content for security.
Context:
This is a security consideration for preventing XSS attacks. The question is whether the model data needs HTML encoding or if only the final HTML output needs encoding.
Acceptance Criteria:
- Research React's approach to HTML encoding
- Implement appropriate encoding strategy
- Add security tests
- Update documentation with security considerations
Issue#5: Root Element and Suspense Handling
Files:
packages/reactDom/src/ReactServerDOM.ml:289packages/reactDom/src/ReactServerDOM.ml:336packages/reactDom/src/ReactServerDOM.ml:337packages/reactDom/src/ReactServerDOM.ml:510
Description:
Clarify and improve root element handling and Suspense component behavior.
Context:
Multiple TODOs about root element handling:
- Can we remove the
is_rootdifference? Purpose is unclear - Need to check if
is_rootlogic applies to Suspense components - Maybe need to push suspense index and suspense node separately
- Do we need to care if there's
Any_promiseraising in Suspense?
Acceptance Criteria:
- Research React's root element handling
- Determine if
is_rootlogic is necessary - Implement appropriate root handling for Suspense components
- Research React's Suspense implementation for index/node handling
- Implement proper Suspense error handling for
Any_promise - Add tests for root element and Suspense behavior
- Update documentation
Issue#6: Context Provider and Consumer Handling
Files:
Description:
Determine if Provider and Consumer components need special handling.
Context:
React Context Provider and Consumer components may need special handling in the server-side rendering pipeline.
Acceptance Criteria:
- Research React Context handling in SSR
- Determine if special Provider/Consumer handling is needed
- Implement appropriate Context handling
- Add tests for Context components
Issue#7: Performance Optimizations
Files:
packages/reactDom/src/ReactServerDOM.ml:711packages/reactDom/src/ReactServerDOM.ml:718packages/reactDom/src/ReactServerDOM.ml:726packages/reactDom/src/ReactServerDOM.ml:731packages/reactDom/src/ReactServerDOM.ml:732
Description:
Various performance improvements including tail recursion, HTML processing, and render optimization.
Context:
Multiple performance-related TODOs:
List.splitis not tail recursive and could cause stack overflowHtml.Listbeing set for single elements may be unnecessary- Implement abortion mechanism based on timeout
- Ensure chunks are of appropriate minimum/maximum size
Acceptance Criteria:
- Replace
List.splitwith tail recursive implementation - Find and optimize
Html.Listusage for single elements - Implement timeout-based render abortion
- Implement minimum and maximum chunk size constraints
- Add tests for large element lists and performance scenarios
- Benchmark performance improvements
- Update documentation with performance considerations
🧪 Test and Deduplication Issues
Issue#8: Client Component Script Deduplication
Files:
packages/reactDom/test/test_RSC_model.ml:902packages/reactDom/test/test_RSC_html.ml:614packages/reactDom/test/test_RSC_html_shell.ml:241packages/reactDom/test/test_RSC_html_shell.ml:301
Description:
Implement deduplication for client component scripts and determine if model deduplication is needed.
Context:
Multiple TODOs about deduplication:
- Don't push multiple scripts for the same client component
- Deduplication only works on HTML currently, unclear if model needs same logic
- Links that aren't hoisted to the head are not deduplicated
Acceptance Criteria:
- Implement client component script deduplication for both model and HTML
- Research if model deduplication is needed
- Implement model deduplication if necessary
- Add tests for deduplication in both model and HTML
- Update test expectations
- Document deduplication behavior