Skip to content

v0.2.0 - Multiple Hydration Passes

Choose a tag to compare

@jkp jkp released this 28 Jul 10:23
· 3 commits to main since this release

What's Changed

✨ New Features

  • Multiple Hydration Passes: Test setup stages can now call preparePageForHydration multiple times before navigation
    • Each call accumulates data instead of overwriting
    • Isolated test stages don't need to know about each other
    • Later hydrations overwrite earlier ones for the same section (last write wins)
    • All errors are aggregated into a single result

🔧 Implementation Details

  • preparePageForHydration now stores blobs in an array (window.__HYDRATION_BLOBS__)
  • bootstrapHydration processes all blobs sequentially (oldest to newest)
  • Results are aggregated where overallSuccess is true only if ALL hydrations succeed
  • Backward compatible - single blob usage still works

📚 Example Usage

// Test setup stage 1 - User profile
await preparePageForHydration(page, {
  userProfile: { name: 'Test User', email: 'test@example.com' }
});

// Test setup stage 2 - Settings (isolated from stage 1)
await preparePageForHydration(page, {
  settings: { theme: 'dark', notifications: true }
});

// Navigate - both hydrations will be applied
await page.goto('/');
const result = await getHydrationResult(page);
// result.sections will contain both userProfile and settings

🧪 Testing

  • Added comprehensive integration tests for multiple hydration scenarios
  • Updated all unit tests to match new implementation
  • All existing tests continue to pass

Full Changelog: v0.1.0...v0.2.0