fix(state): record hydrated computed values

Closed
KR
11d ago
+259-3

Summary

Hydration sends uncached computed values without recording them, so the next event sends the same values again. This addresses the hydration resend reported in #7253.

What changed

  • Record resolved computed values after successful snapshot emission in both hydration handlers.
  • Include defaults already held by clients with matching initial-state hashes.
  • Preserve hydration corrections from current main and record their final values only after successful delivery.
  • Cover sync and async values, nested states, persistence, reconnects and failed emission. Add a performance news fragment.

Dictionary order remains observable by the frontend. Unsupported values still deduplicate by their serialized null value.

Verification

  • Four hydration regressions failed before the fix.

  • Full unit run after merging current main: 11,472 passed and 159 skipped, with 79.22% coverage.

  • uv run ruff check ., uv run ruff format --check . and uv run pyright reflex tests passed.

  • Initial dev and production browser checks verified hydration, unchanged events, changed values and reload. After the merge, a real production Socket.IO check passed hydration, unchanged events, changed values and reconnects.

  • Non-breaking bug fix

  • Regression coverage added

  • Local runtime behavior verified