electric icon indicating copy to clipboard operation
electric copied to clipboard

Fix multiple renders from cached up-to-date messages on page refresh

Open KyleAMathews opened this issue 1 month ago • 1 comments

When a shape receives multiple updates within the HTTP cache window (60s), each update ends with an up-to-date control message that gets cached. On page refresh, these cached responses replay rapidly, causing multiple renders. This change implements cursor-based detection to suppress cached up-to-date notifications until a fresh response (with a new cursor) arrives from the server, ensuring only one render occurs.

KyleAMathews avatar Oct 30 '25 13:10 KyleAMathews

Codecov Report

:x: Patch coverage is 94.04762% with 5 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 67.72%. Comparing base (6f9bba2) to head (1b4c592). :warning: Report is 67 commits behind head on main.

Files with missing lines Patch % Lines
...ckages/typescript-client/src/up-to-date-tracker.ts 93.93% 4 Missing :warning:
packages/typescript-client/src/client.ts 94.44% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3358      +/-   ##
==========================================
- Coverage   70.14%   67.72%   -2.42%     
==========================================
  Files         178      183       +5     
  Lines        9606     9826     +220     
  Branches      290      381      +91     
==========================================
- Hits         6738     6655      -83     
- Misses       2866     3169     +303     
  Partials        2        2              
Flag Coverage Δ
elixir 64.04% <ø> (-2.86%) :arrow_down:
elixir-client 73.94% <ø> (-0.53%) :arrow_down:
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/typescript-client 93.62% <94.04%> (-0.57%) :arrow_down:
packages/y-electric 55.12% <ø> (?)
postgres-140000 62.77% <ø> (-3.20%) :arrow_down:
postgres-150000 62.82% <ø> (?)
postgres-170000 62.85% <ø> (-3.15%) :arrow_down:
postgres-180000 62.88% <ø> (?)
sync-service 63.05% <ø> (-3.10%) :arrow_down:
typescript 87.53% <94.04%> (-5.31%) :arrow_down:
unit-tests 67.72% <94.04%> (-2.42%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Oct 30 '25 13:10 codecov[bot]

Open in StackBlitz

npm i https://pkg.pr.new/@electric-sql/react@3358
npm i https://pkg.pr.new/@electric-sql/client@3358
npm i https://pkg.pr.new/@electric-sql/y-electric@3358

commit: 1b4c592

pkg-pr-new[bot] avatar Nov 19 '25 16:11 pkg-pr-new[bot]

Deploy Preview for electric-next ready!

Name Link
Latest commit 1b4c59244f1491ceef7ee1c3f9894431e90874d7
Latest deploy log https://app.netlify.com/projects/electric-next/deploys/691df2261907af0008a2d06c
Deploy Preview https://deploy-preview-3358--electric-next.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Nov 19 '25 16:11 netlify[bot]