feat: enhanced error handling and a ton of bugfixes showcased in a new example app #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This update brings significant improvements, including a brand-new Pokémon example app designed to demonstrate the framework's enhanced error handling and caching capabilities and to showcase superb performance. In addition to the example app, this PR introduces a series of crucial bug fixes, navigation improvements, and optimizations to both client-side and server-side behavior.
A new
Form
navigation component has been introduced to simplify navigation based on form interactions. This component allows developers to trigger navigation based on form submissions or specific input values, without requiring additional event handlers or imperative navigation logic. This enables form-driven navigation patterns where a user’s input can dictate the next page, improving declarative control over navigation behavior.A new mechanism for controlling when client-side navigation triggers revalidation has been added. Previously, navigation could result in unnecessary revalidation of server-side rendering, even in cases where it was not required. This led to excessive network requests and performance overhead. Now, developers can explicitly define revalidation strategies, ensuring that only the relevant components are refreshed based on user interactions or navigation. This fine-grained control allows for more efficient client-side navigation while maintaining consistency.
A global error component has been introduced to standardize error handling across applications. Instead of handling errors in multiple locations with redundant logic, applications can now define a centralized error component that gracefully captures and displays errors. This ensures a consistent error experience for users while also simplifying maintenance by reducing duplicated error handling logic. This feature also enables styling unexpected error caught during server-side rendering.
Several issues related to module resolution when using
npx
have been addressed. Previously, certain dependencies would not resolve correctly when executed the react-server CLI vianpx
, causing unexpected failures when running commands that relied on specific@lazarv/react-server
modules. These resolution issues have now been fixed, ensuring that executing commands vianpx
correctly locates and loads the necessary modules without manual intervention.A fix has been applied to server function calls to ensure that
redirect
responses behave correctly. Previously, certain redirect scenarios did not properly propagate the response to the client, resulting in broken navigation flows. This has now been corrected, allowing server functions to issue redirects that are correctly handled by the client. #110Default CORS configuration has been adjusted to address inconsistencies in handling requests across different origins. The previous implementation had cases where preflight requests were either incorrectly blocked or missing required headers. The fixed configuration usage ensures that cross-origin requests function correctly, particularly for applications interacting with APIs and remote components from different domains.
React Server Component network requests have been updated to support credential transmission. This change ensures that cookies are correctly included in all relevant RSC network requests. This improvement allows for more seamless authentication handling without requiring manual workarounds.
Support for the
"use cache"
directive has been extended to additional use cases. Previously, this directive was limited in scope and did not fully cover all expected scenarios, particularly when used in certain asynchronous server function calls. These fixes ensure that"use cache"
now applies more broadly and reliably across different execution contexts, allowing more efficient caching behavior and reducing redundant server computations.Several issues affecting
RemoteComponent
and remote rendering have been addressed. These fixes ensure that remotely loaded components behave consistently, resolving previous issues where rendering states were not properly handled. Remote rendering now correctly handles component hydration using both sync and async React Server Components, preventing unexpected behaviour.File-system based routing has been improved to correctly apply error boundaries at the appropriate levels, particularly for route outlets. Previously, some errors were not caught at the intended boundary, causing them to propagate unintentionally. With this update, errors encountered within a specific route segment are correctly handled by the nearest applicable error boundary, ensuring better application stability and predictable error recovery.
The documentation has been updated to include details on the new APIs introduced in this release. This includes explanations of the enhanced error handling system, details on how to use the new
Form
navigation component, and guidelines for configuring client-side navigation revalidation. Additionally, examples have been added to clarify best practices for handling errors at different levels of an application.