Skip to content

Conversation

@AbanoubGhadban
Copy link
Collaborator

@AbanoubGhadban AbanoubGhadban commented Dec 11, 2024

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/update test to cover these changes
  • Update documentation
  • Update CHANGELOG file
    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.


This change is Reviewable

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@AbanoubGhadban AbanoubGhadban mentioned this pull request Dec 16, 2024
3 tasks
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro425/hydrate-components-immediately-after-downloading-chunks branch from c676342 to 266acae Compare December 18, 2024 10:20
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch 2 times, most recently from ed1170b to 59b0f0d Compare December 23, 2024 17:52
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro425/hydrate-components-immediately-after-downloading-chunks branch from f2242c4 to a761735 Compare December 24, 2024 09:16
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch 2 times, most recently from 7133c56 to 838a6e7 Compare December 24, 2024 10:05
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch from 4e89e93 to 07fb03e Compare January 13, 2025 14:43
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro425/hydrate-components-immediately-after-downloading-chunks branch from 1f3e921 to 999312d Compare January 16, 2025 13:31
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch from 07fb03e to 84b5cb5 Compare January 16, 2025 13:32
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro425/hydrate-components-immediately-after-downloading-chunks branch from 999312d to aeaeca4 Compare January 25, 2025 14:38
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch from 2405c2c to e1fdfc7 Compare January 25, 2025 15:14
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro425/hydrate-components-immediately-after-downloading-chunks branch from aeaeca4 to 58fd819 Compare January 25, 2025 15:16
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch 3 times, most recently from 01fe6ab to 767fefc Compare January 27, 2025 15:15
AbanoubGhadban and others added 10 commits January 27, 2025 17:29
- Add `dev_server_url` helper to centralize dev server URL construction
- Add `public_output_uri_path` to get relative webpack output path
- Add `asset_uri_from_packer` to handle asset URIs consistently
- Update `react_client_manifest_file_path` to return dev server URLs when appropriate
- Add comprehensive specs for new asset URI handling

This change ensures client manifest paths are properly resolved to dev server
URLs during development, improving hot-reloading functionality.
@AbanoubGhadban AbanoubGhadban force-pushed the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch from eb73bef to 411207c Compare January 27, 2025 15:30
@Judahmeek Judahmeek marked this pull request as ready for review January 30, 2025 00:00
@Judahmeek Judahmeek merged commit ba38c98 into abanoubghadban/pro425/hydrate-components-immediately-after-downloading-chunks Jan 30, 2025
11 checks passed
@Judahmeek Judahmeek deleted the abanoubghadban/pro488/handle-errors-happen-in-rsc-payload branch January 30, 2025 00:02
Judahmeek added a commit that referenced this pull request Jan 31, 2025
* hydrate the component immediately when loaded and registered
* auto register server components and immediately hydrate stores
* move react-server-dom-webpack.d.ts to types directory
* ensure to initialize registered stores array before accessing
* refactor registration callback into separate class
* make the early hydration compatible with turbopack, backward compatible and refactor
* pass rsc path to RSC Client Root and move the config to RORP
* update min node version to 18
* export registerServerComponent as a separate entrypoint to avoid client bundle increase
* Update webpack assets status checker to use server bundle configuration
* Update webpack assets status checker to handle bundle file paths
* [WIP] handle errors happen in rsc payload (#1663)
* stream rsc payload in json objects like streamed react components
* make path to rsc bundle and react client manifest configurable

* feat: Improve client manifest path handling for dev server

- Add `dev_server_url` helper to centralize dev server URL construction
- Add `public_output_uri_path` to get relative webpack output path
- Add `asset_uri_from_packer` to handle asset URIs consistently
- Update `react_client_manifest_file_path` to return dev server URLs when appropriate
- Add comprehensive specs for new asset URI handling

This change ensures client manifest paths are properly resolved to dev server
URLs during development, improving hot-reloading functionality.

* fix: normalize RSC URL path by absorbing leading/trailing slashes
* specify Shakapacker as top-level module
* add tests for RSCClientRoot
* Make RSCClientRoot tests run with react 18
* Update webpack asset path configuration for client manifest

---------

Co-authored-by: Judah Meek <[email protected]>
AbanoubGhadban added a commit that referenced this pull request Mar 4, 2025
* hydrate the component immediately when loaded and registered
* auto register server components and immediately hydrate stores
* move react-server-dom-webpack.d.ts to types directory
* ensure to initialize registered stores array before accessing
* refactor registration callback into separate class
* make the early hydration compatible with turbopack, backward compatible and refactor
* pass rsc path to RSC Client Root and move the config to RORP
* update min node version to 18
* export registerServerComponent as a separate entrypoint to avoid client bundle increase
* Update webpack assets status checker to use server bundle configuration
* Update webpack assets status checker to handle bundle file paths
* [WIP] handle errors happen in rsc payload (#1663)
* stream rsc payload in json objects like streamed react components
* make path to rsc bundle and react client manifest configurable

* feat: Improve client manifest path handling for dev server

- Add `dev_server_url` helper to centralize dev server URL construction
- Add `public_output_uri_path` to get relative webpack output path
- Add `asset_uri_from_packer` to handle asset URIs consistently
- Update `react_client_manifest_file_path` to return dev server URLs when appropriate
- Add comprehensive specs for new asset URI handling

This change ensures client manifest paths are properly resolved to dev server
URLs during development, improving hot-reloading functionality.

* fix: normalize RSC URL path by absorbing leading/trailing slashes
* specify Shakapacker as top-level module
* add tests for RSCClientRoot
* Make RSCClientRoot tests run with react 18
* Update webpack asset path configuration for client manifest

---------

Co-authored-by: Judah Meek <[email protected]>
justin808 pushed a commit that referenced this pull request Mar 7, 2025
* hydrate the component immediately when loaded and registered
* auto register server components and immediately hydrate stores
* move react-server-dom-webpack.d.ts to types directory
* ensure to initialize registered stores array before accessing
* refactor registration callback into separate class
* make the early hydration compatible with turbopack, backward compatible and refactor
* pass rsc path to RSC Client Root and move the config to RORP
* update min node version to 18
* export registerServerComponent as a separate entrypoint to avoid client bundle increase
* Update webpack assets status checker to use server bundle configuration
* Update webpack assets status checker to handle bundle file paths
* [WIP] handle errors happen in rsc payload (#1663)
* stream rsc payload in json objects like streamed react components
* make path to rsc bundle and react client manifest configurable
* feat: Improve client manifest path handling for dev server
- Add `dev_server_url` helper to centralize dev server URL construction
- Add `public_output_uri_path` to get relative webpack output path
- Add `asset_uri_from_packer` to handle asset URIs consistently
- Update `react_client_manifest_file_path` to return dev server URLs when appropriate
- Add comprehensive specs for new asset URI handling

This change ensures client manifest paths are properly resolved to dev server
URLs during development, improving hot-reloading functionality.

* fix: normalize RSC URL path by absorbing leading/trailing slashes
* specify Shakapacker as top-level module
* add tests for RSCClientRoot
* Make RSCClientRoot tests run with react 18
* Update webpack asset path configuration for client manifest

* Fix client startup rendering when the script runs after the page loaded
* Refactor client-side rendering and page lifecycle management
- Extract context and page lifecycle utilities into separate modules
- Improve handling of Turbolinks and Turbo events
- Simplify client startup and rendering process
- Add more robust page load and unload event management
- Rename and reorganize context-related functions
* Add component registry timeout configuration
- Introduce a new configuration option `component_registry_timeout` to control the maximum time to wait for client-side component registration
- Update `CallbackRegistry` to handle timeout events and reject pending callbacks
- Add validation for the timeout configuration in the Rails configuration
- Modify client-side startup and page lifecycle to support the new timeout mechanism
- Enhance error handling for unregistered components and stores
* Refactor CallbackRegistry and clientStartup initialization
- Move `initializeTimeoutEvents()` call to `getOrWaitForItem()` method in CallbackRegistry
- Remove unnecessary 4-second delay in clientStartup
- Clean up commented-out webpack configuration in clientWebpackConfig
* Update StoreRegistry error messages for clarity
* Fix RSC stream parsing to handle incomplete chunks
- Introduce `lastIncompleteChunk` to preserve partial JSON data between stream reads
- Ensure complete JSON chunks are processed by splitting on newlines
- Handle cases where the last chunk is not terminated with a newline
* Refactor CallbackRegistry to improve item tracking and usage
- Introduce `ItemInfo` type to track item registration, usage, and promise details
- Enhance timeout handling with more informative warnings for unused items
- Improve `get`, `has`, and `getAll` methods to better track item usage
- Optimize `getOrWaitForItem` to handle existing promises and registration states
* Refactor CallbackRegistry and ComponentRegistry to simplify item tracking
- Simplify CallbackRegistry by separating item storage and waiting promises
- Introduce separate maps for registered items and waiting promises
- Add a set to track unused items
- Update ComponentRegistry to include a clear method
- Modify test to use new clear method
* Update StoreRegistry test to use clearHydratedStores method
* Update RSC test to append newline to stream chunks
* don't strip the html chunk
* Add "use client" directive to RSCClientRoot
* Convert RSCWebpackLoader to TypeScript
* Comment on the need for workaround
* Fix Knip
* Simplify RSCWebpackLoader
* remove rsc? and stream? render options and add render_mode option
* Rename flight_payload_streaming to rsc_payload_streaming
* Add async component retrieval and timeout handling to ComponentRegistry
* add specs for packs generator
* Update react_on_rails_helper_spec with new props added to component definition script

* Remove webpacker dependency from Gemfile.lock

* Remove unnecessary webpacker mocking in configuration spec

* Update package.json exports for React Server Components

* fix: don't trim html content on server

* Enable prerendering by default for React Server Components

* Rename RSC rendering methods and configuration to payload generation

* add more comments for new components

* linting

* Update package.json exports order for React Server Components

* remove prerender option for stream_react_component

* small linting changes

* Use node 16 to run oldes tests

* Remove unnecessary data-store-dependencies attribute from test scripts

* linting

* Convert loadReactClientManifest to async and update RSC rendering

* make RSCClientRoot tests compatible with React 19

* Test fetch function only with node version 18+

* pass props to RSC generator and avoid state reset on hydration

* Add ignore configuration for Knip static analysis

* small changes

* Implement stream buffering to safely handle stream events and errors

* Fix stream error emission in buffered stream

* Simplify streaming result parsing logic in server rendering

* remove mentions to experiment react 18 and use only react 19

* Refactor registerServerComponent into client and server modules

* Add RSCWebpackPlugin for React Server Components

* Replace react-server-dom-webpack with @shakacode-tools/react-on-rails-rsc

* Update TypeScript configuration and package dependencies for React Server Components

* Remove webpack dependency from package configuration

* Update @shakacode-tools/react-on-rails-rsc dependency to latest commit

* Make reactOnRailsPageLoaded async

* Update configuration to enable force_load by default and modify redux_store helper

* Bump version to 15.0.0-alpha.2 and update CHANGELOG

* revert this: Update package to use @abanoubghadban/react-on-rails-rsc

* Configure .npmrc for private GitHub package registry

* Update import statements for path and fs modules in test file

* Update test specs to add data-force-load attribute by default

* Add null check for ReactOnRails global object in component and store loading scripts

* Bump version to 15.0.0.alpha.2

* Update GitHub Actions workflows to use Shakacode Tools Packages Token

* Update package to use @shakacode-tools/react-on-rails-rsc

* Revert version to 14.2.0 and update CHANGELOG

* Enhance server-side rendering error logging and debugging

- Add full backtrace to error messages for better diagnostics
- Add temporary debugging breakpoint with binding.pry

* Remove temporary debugging breakpoint in server rendering

* Revert gem version to 14.2.0 in Gemfile.lock

* Remove backtrace from server rendering error logging

* Update package to use react-on-rails-rsc package instead of the old private package

* Update CHANGELOG and knip configuration

- Add description for unreleased changes in CHANGELOG
- Remove unused entry from knip configuration
- Add jsdom as a development dependency in knip config

* Change default defer behavior for generated component packs

* Update test to reflect new default defer behavior for generated component packs

* Update CHANGELOG and release notes for React on Rails 15.0.0

- Add comprehensive release notes for version 15.0.0
- Highlight major features: React Server Components support and improved component hydration
- Document breaking changes related to component hydration and store dependencies
- Summarize key improvements in component and store hydration performance

* Add domNodeId support for server-side rendering identifier prefix to support multiple components in the view

* Remove PR references from 15.0.0 release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants