Repository navigation
fix(web): await or handle the floating promises the linter suppressed - #1219
Merged
Merged
Conversation
Tests await the promises they start. Under BrowserRouter navigate() returns nothing, so App.tsx applies React Router's documented declarative-mode type augmentation. The Dashboard's page-level verdict chain now logs a failure instead of leaving an unhandled rejection. Prunes every no-floating-promises suppression. Refs #1167
Codex review: rejecting Promise.allSettled itself skipped the verdict callback, so a catch placed before .then still passed. A null result now makes the callback throw. Refs #1167
Owner
Author
|
Codex review, round 1 (local review, no inline thread). Finding: the Dashboard verdict test made Fixed in 8f8e8ea. The test now resolves Red/green, run on
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1167
Removes all 16
@typescript-eslint/no-floating-promisessuppressions left on main. Entries for other rules are untouched.What changed
Tests (12 sites).
farmCodeCache.test.tsnow awaitsrememberFarmCode. The quota test asserts.resolvesand no longer usesnot.toThrow(), because an async function never throws synchronously, so the old assertion could not fail.client.test.tskeeps each fake "other tab" lock hold and awaits it after releasing it, so a rejection in the hold now fails the test.navigate()inLogin.tsx(2) andAppLayout.tsx(1). The app uses<BrowserRouter>, wherenavigate()returnsundefined. Only a data router returns a Promise. React Router types the return asvoid | Promise<void>and documents a module augmentation for declarative mode.App.tsxapplies it beside<BrowserRouter>. These calls have no promise and no failure path, so there is nothing to test at runtime. The mutation proof is the linter: without the augmentation, lint reports the same three sites again.Dashboard.tsx(1). The page-level verdict chain (Promise.allSettled(...).then(...)) had no rejection handler. It now logs withconsole.error("dashboard: panels verdict failed", err), the same patternclient.tsuses.allSettlednever rejects and the callback only sets state, so no real input reaches this path today. The new test makesPromise.allSettledresolve withnullonce, so the verdict callback itself throws.Proof
Unhandled Rejection: TypeErrorwhen the.catchis removed, and also when it is moved before.then. With the code as shipped, it passes. (Codex review, round 1, caught that the first version of this test missed the second mutation.)npm run lint -- --prune-suppressionsleaves 0no-floating-promisesentries, andnode lint/check-suppressions.mjspasses.npm run lintandnpm run typecheckare clean.npx vitest run --maxWorkers=2onclient.test.ts,farmCodeCache.test.ts,Dashboard.test.tsx,Login.test.tsxandAppLayout.test.tsx: 384 passed.Screenshots
None. Nothing a user sees changes. The
navigatechange is type-only, and the Dashboard handler writes to the console on a path no current input reaches.Not changed
Login.tsx:93keepsvoid previewConsent(...). That function catches every error and returnsnull, so it cannot reject.