feat(dashboards): don't retry W-ASAP validation errors in fetchWasapPageData - #1362
Conversation
Introduce WasapValidationError for config/state validation failures (mode not enabled, no collection selected, etc.) and tell React Query not to retry them, so the UI doesn't spin for ~7s on states that are immediately known to be invalid. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR improves the W-ASAP page data loading behavior by distinguishing deterministic config/state validation failures from transient/network failures, so React Query can avoid unnecessary retries and the UI can surface invalid states immediately instead of “loading” for ~7 seconds.
Changes:
- Introduces a
WasapValidationErrorfor deterministic W-ASAP validation failures (mode disabled, missing collection, missing variant, etc.). - Configures
useWasapPageData’s React Queryretrybehavior to not retryWasapValidationErrors. - Updates unit tests to reflect the new error type.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| website/src/components/views/wasap/useWasapPageData.ts | Adds WasapValidationError and updates query retry behavior + throws to use the typed validation error. |
| website/src/components/views/wasap/useWasapPageData.spec.ts | Updates tests to expect the new validation error behavior. |
Comments suppressed due to low confidence (6)
website/src/components/views/wasap/useWasapPageData.spec.ts:313
toThrow(new WasapValidationError(...))only asserts the message, not that the rejection is actually aWasapValidationError. This test can pass even if a plainErroris thrown with the same message.
).rejects.toThrow(new WasapValidationError("Cannot fetch data, 'variant' mode is not enabled."));
website/src/components/views/wasap/useWasapPageData.spec.ts:414
toThrow(new WasapValidationError(...))only asserts the message, not that the rejection is actually aWasapValidationError. This test can pass even if a plainErroris thrown with the same message.
).rejects.toThrow(new WasapValidationError("Cannot fetch data, 'untracked' mode is not enabled."));
website/src/components/views/wasap/useWasapPageData.spec.ts:563
toThrow(new WasapValidationError(...))only asserts the message, not that the rejection is actually aWasapValidationError. This test can pass even if a plainErroris thrown with the same message.
).rejects.toThrow(
new WasapValidationError("Cannot fetch data, 'covSpectrumCollection' mode is not enabled."),
);
website/src/components/views/wasap/useWasapPageData.spec.ts:573
toThrow(new WasapValidationError(...))only asserts the message, not that the rejection is actually aWasapValidationError. This test can pass even if a plainErroris thrown with the same message.
).rejects.toThrow(new WasapValidationError('No collection selected'));
website/src/components/views/wasap/useWasapPageData.spec.ts:943
toThrow(new WasapValidationError(...))only asserts the message, not that the rejection is actually aWasapValidationError. This test can pass even if a plainErroris thrown with the same message.
).rejects.toThrow(new WasapValidationError("Cannot fetch data, 'collection' mode is not enabled."));
website/src/components/views/wasap/useWasapPageData.spec.ts:949
toThrow(new WasapValidationError(...))only asserts the message, not that the rejection is actually aWasapValidationError. This test can pass even if a plainErroris thrown with the same message.
).rejects.toThrow(new WasapValidationError('No collection selected'));
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#1349
Summary
Introduce WasapValidationError for config/state validation failures (mode not enabled, no collection selected, etc.) and tell React Query not to retry them, so the UI doesn't spin for ~7s on states that are immediately known to be invalid.
PR Checklist
All necessary documentation has been adapted.