Repository navigation
fix(cli): catch up on the missed reload when a skipped client responds again - #1003
lewinpauli wants to merge 3 commits into
Conversation
Package Version ReportThe following packages have been updated: |
There was a problem hiding this comment.
🟡 Changes recommended
The catch-up path clears the missed action before successful application, so a failed restart can be lost and followed by only a reload instead of being preserved for retry.
1 open issue
What changed in this PR
This follow-up to #980 adds catch-up updates for browsers skipped by jaspr serve, so recovering clients receive missed changes without blocking other clients.
Changes:
- Tracks the most extensive missed update and applies it without a timeout, followed by pending stylesheets.
- Centralizes per-client update steps in
ClientConnection.update. - Adds regression tests for recovery, slow clients, update priority, and updates queued during catch-up.
| File | Description |
|---|---|
packages/jaspr/CHANGELOG.md |
Documents automatic catch-up for skipped browsers. |
packages/jaspr_cli/test/src/dev/dev_workflow_test.dart |
Adds and extends catch-up regression tests. |
packages/jaspr_cli/lib/src/dev/dev_workflow.dart |
Delegates per-client updates to ClientConnection.update. |
packages/jaspr_cli/lib/src/dev/client_manager.dart |
Tracks missed updates and implements per-client catch-up. |
Review effort: Balanced
| _missedUpdate = null; | ||
| await _apply(update, _unguarded); |
There was a problem hiding this comment.
Fixed in "keep an update the catch-up could not apply for the next update". If the catch-up fails or throws, the update stays missed and the next regular update includes it, so a missed restart is no longer replaced by a reload. There is no retry loop: the next attempt only happens with the next update, or when the client becomes responsive again.
Added a regression test (includes an update the catch-up could not apply in the next update). It fails without keeping the update and without merging it into the next update.
…sive-client # Conflicts: # packages/jaspr/CHANGELOG.md

Follow-up to #980.
Description
Since #980,
jaspr serveskips a browser that doesn't answer a reload within 10 seconds. When the browser answers again, only changed stylesheets are delivered. The rest of the reload is not, and the log says "it may show outdated content until the next reload".For a tab in the background this means it never gets up to date: the browser throttles it, so the next reload times out as well. I ran into this with Chrome covered by the editor. Every save logged "did not respond", and the tab kept showing the old state after I switched to it.
This PR
DevWorkflowintoClientConnection.update, so the regular update and the catch-up share them.Tests (
dev_workflow_test.dart)reload/restart/refresh skips a browser that stops respondingnow also expects the catch-up. Fails without the fix.reload/restart is repeated for a browser that responds again after it timed out. Fails without the fix.refresh is not repeated for a browser that responds again after it timed out. Fails if a timed out refresh is marked as missed.catches up with the most extensive update a browser missed. Fails if the last missed update wins.includes an update the catch-up could not apply in the next update. Fails if a failed catch-up drops the update.catches up a browser that responds slower than the timeout. Fails if the catch-up uses the call timeout.updates skip a browser that is catching up and are applied afterwards. Fails if updates don't skip a client that is catching up.Not tested in a real browser, only with the fakes of the test suite.
The red
Test CLIjobs with Flutter (cnen, cspn, smpn, snpn, vnen) are not caused by this PR. They fail onmainsince the CI picked up Flutter 3.50 (#999), the fix is in #1000.Type of Change
Ready Checklist
the semantic_changelog format.
///).