Coralite v0.38.2 Released
Coralite v0.38.2 addresses key synchronization issues between server-side rendering (SSR) and the client bundle. This patch release ensures that data returned from the server() function reliably propagates to client state, client getters, and imperative APIs during hydration.
Reliable server() State and Getters Propagation #
In previous versions, data returned by the server-side server() hook occasionally failed to reflect correctly in the initial client state or computed getters during hydration. This release fixes those synchronization gaps with several targeted enhancements:
- Strict Validation: Implemented strict validation checks for
server()return values, ensuring they resolve to a truthy object before proceeding with hydration. - Hydration Payload Integration: All keys evaluated and returned by the server-side logic are now explicitly guaranteed to be included in the hydration payload and mapped to the initial client state.
- Default Value Overwrites: Values returned from the
server()hook will now correctly overwrite any client-side default values defined in your component's state. - Imperative Component Availability: Base evaluation results from the server are now accessible to imperative components via
defaultValues. - Removal of 'Smart' Filtering: Removed complex and unreliable filtering of state keys for the client bundle to achieve a more predictable and robust data flow.
Here is an example demonstrating how server-evaluated results now correctly overwrite client state default values during initialization:
// Server-side logic
export async function server(context) {
return {
theme: 'dark',
authenticated: true
};
}
// Client-side component state definition
export const state = {
theme: 'light', // Overwritten by 'dark' during hydration
authenticated: false // Overwritten by true during hydration
};
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.38.2
npm install coralite-scripts@0.38.2
