Handle in-flight request cancellation in billing hook#130
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| } catch (e) { | ||
| console.error(e); | ||
| if (requestIdRef.current === id) { | ||
| if (e.name !== 'AbortError') { | ||
| console.error(e); | ||
| setError(e.message || String(e)); | ||
| } |
There was a problem hiding this comment.
[P1] Treat cancelled cockpit.spawn as non-errors
When aborting an in‑flight request the catch block only ignores exceptions whose name is 'AbortError'. cockpit.spawn rejects with objects whose problem is 'cancelled' rather than that name, so cancelling the previous request (e.g. when switching months quickly or unmounting) will still trigger console.error and populate error. The UI therefore flashes a load failure even though the cancellation was expected and a replacement request is underway.
Useful? React with 👍 / 👎.
Summary
useBillingDataloadingflagTesting
make checkhttps://chatgpt.com/codex/tasks/task_e_68bf9e186dc88324a2df8456530d7367