fix: clear recovered travel errors

This commit is contained in:
Bastian Wagner
2026-08-18 22:07:08 +02:00
parent a738c61611
commit 6304703d67
3 changed files with 31 additions and 0 deletions

View File

@@ -59,6 +59,34 @@ git diff --check -- <Task-7 files>
# 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
there is no repository-configured lint command to run for this task.

View File

@@ -166,11 +166,13 @@ describe('WorldStore', () => {
await vi.advanceTimersByTimeAsync(999);
expect(api.getCurrentTravel).toHaveBeenCalledTimes(2);
expect(store.error()).toBe('Temporary failure');
await vi.advanceTimersByTimeAsync(1);
expect(api.getCurrentTravel).toHaveBeenCalledTimes(3);
expect(store.currentTravel()).toEqual({ status: 'IDLE' });
expect(store.error()).toBeNull();
});
it('ignores a late poll response after the store is destroyed', async () => {

View File

@@ -173,6 +173,7 @@ export class WorldStore implements OnDestroy {
return;
}
this.errorState.set(null);
await this.setCurrentTravel(travel);
if (travel.status === 'TRAVELLING') {
this.scheduleTravelRetry();