-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhanced error handling and a ton of bugfixes showcased in a ne…
…w example app (#111) 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 via `npx`, 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 via `npx` 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. #110 Default 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.
- Loading branch information
Showing
101 changed files
with
4,868 additions
and
1,362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "@lazarv/react-server-example-pokemon", | ||
"private": true, | ||
"description": "React Server Pokemon example application", | ||
"scripts": { | ||
"dev": "react-server", | ||
"build": "react-server build", | ||
"start": "react-server start" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@lazarv/react-server": "workspace:^", | ||
"clsx": "^2.1.1", | ||
"tailwind-merge": "^2.6.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.3.2", | ||
"@types/react-dom": "^18.3.0", | ||
"autoprefixer": "^10.4.19", | ||
"postcss": "^8.4.38", | ||
"tailwindcss": "^3.4.3", | ||
"vite": "6.0.0-alpha.18" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"root": "src/app" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { status } from "@lazarv/react-server"; | ||
import { Link } from "@lazarv/react-server/navigation"; | ||
|
||
export default function NotFound() { | ||
status(404); | ||
|
||
return ( | ||
<div className="fixed inset-0 flex flex-col gap-4 items-center justify-center"> | ||
<h1 className="text-4xl font-bold">Not Found</h1> | ||
<p className="text-lg">The page you are looking for does not exist.</p> | ||
<Link to="/" root noCache> | ||
Go back to the home page | ||
</Link> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.