fix: clear recovered travel errors
This commit is contained in:
@@ -59,6 +59,34 @@ git diff --check -- <Task-7 files>
|
|||||||
# exit 0
|
# exit 0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Review fix round 2
|
||||||
|
|
||||||
|
The transient-poll regression now asserts both phases: the failed poll exposes
|
||||||
|
`Temporary failure`, and the successful authoritative `IDLE` retry clears it.
|
||||||
|
The new assertion was RED against the prior implementation because the error
|
||||||
|
remained set after the retry. `refreshCurrentTravel()` now clears the polling
|
||||||
|
error only after a successful API response and before applying that response;
|
||||||
|
the countdown contract and all other error paths are unchanged.
|
||||||
|
|
||||||
|
Fresh verification:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
npm test --workspace=@ashen-realms/web -- --watch=false --include='src/app/features/world/world.store.spec.ts'
|
||||||
|
# 1 test file passed, 9 tests passed
|
||||||
|
|
||||||
|
npm test --workspace=@ashen-realms/web -- --watch=false
|
||||||
|
# 3 test files passed, 13 tests passed
|
||||||
|
|
||||||
|
npm run build:web
|
||||||
|
# Angular production build completed successfully
|
||||||
|
|
||||||
|
npm exec --workspace=@ashen-realms/web -- prettier --check <Task-7 files>
|
||||||
|
# All matched files use Prettier code style
|
||||||
|
|
||||||
|
git diff --check -- <Task-7 files>
|
||||||
|
# exit 0
|
||||||
|
```
|
||||||
|
|
||||||
The web workspace declares neither a `lint` script nor an ESLint dependency, so
|
The web workspace declares neither a `lint` script nor an ESLint dependency, so
|
||||||
there is no repository-configured lint command to run for this task.
|
there is no repository-configured lint command to run for this task.
|
||||||
|
|
||||||
|
|||||||
@@ -166,11 +166,13 @@ describe('WorldStore', () => {
|
|||||||
await vi.advanceTimersByTimeAsync(999);
|
await vi.advanceTimersByTimeAsync(999);
|
||||||
|
|
||||||
expect(api.getCurrentTravel).toHaveBeenCalledTimes(2);
|
expect(api.getCurrentTravel).toHaveBeenCalledTimes(2);
|
||||||
|
expect(store.error()).toBe('Temporary failure');
|
||||||
|
|
||||||
await vi.advanceTimersByTimeAsync(1);
|
await vi.advanceTimersByTimeAsync(1);
|
||||||
|
|
||||||
expect(api.getCurrentTravel).toHaveBeenCalledTimes(3);
|
expect(api.getCurrentTravel).toHaveBeenCalledTimes(3);
|
||||||
expect(store.currentTravel()).toEqual({ status: 'IDLE' });
|
expect(store.currentTravel()).toEqual({ status: 'IDLE' });
|
||||||
|
expect(store.error()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ignores a late poll response after the store is destroyed', async () => {
|
it('ignores a late poll response after the store is destroyed', async () => {
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ export class WorldStore implements OnDestroy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.errorState.set(null);
|
||||||
await this.setCurrentTravel(travel);
|
await this.setCurrentTravel(travel);
|
||||||
if (travel.status === 'TRAVELLING') {
|
if (travel.status === 'TRAVELLING') {
|
||||||
this.scheduleTravelRetry();
|
this.scheduleTravelRetry();
|
||||||
|
|||||||
Reference in New Issue
Block a user