[
https://issues.apache.org/jira/browse/HDDS-17691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sravani Revuri updated HDDS-17691:
----------------------------------
Description: seApiData triggers executeRequest() from the URL useEffect
(initial mount and URL changes) and from the retry setTimeout without handling
the returned promise. On failure, executeRequest already updates state and
calls onError, but still rejects the promise, which causes unhandled rejections
in Vitest and in the browser console . Fix by attaching a no-op .catch() to
those fire-and-forget calls; leave execute / refetch unchanged for callers that
await and handle errors. (was: The URL useEffect in
v2/hooks/useAPIData.hook.ts calls executeRequest() on initial mount and on URL
change, and neither call has a .catch(). executeRequest always rejects on
failure, even after it has set error state and called onError. So every failed
GET leaves an unhandled rejection, in tests and in the browser.
Missing call site: The retry path has the same problem:
retryTimeoutRef.current = setTimeout(() => {
executeRequest(requestData, true); // also uncaught
}, retryDelay * retryCountRef.current);
A 500 with retries left goes through this branch, so each retry attempt also
rejects unhandled. The Jira should say: "add .catch() to the GET calls in the
URL effect and to the retried executeRequest in the retry setTimeout." A no-op
catch is enough, since error state and onError are already handled inside
executeRequest. It also covers the CanceledError rejection when a URL change
aborts the request in flight.)
> [Recon][UI]Handle failed GET rejections in useApiData
> -----------------------------------------------------
>
> Key: HDDS-17691
> URL: https://issues.apache.org/jira/browse/HDDS-17691
> Project: Apache Ozone
> Issue Type: Bug
> Reporter: Sravani Revuri
> Assignee: Sravani Revuri
> Priority: Major
>
> seApiData triggers executeRequest() from the URL useEffect (initial mount and
> URL changes) and from the retry setTimeout without handling the returned
> promise. On failure, executeRequest already updates state and calls onError,
> but still rejects the promise, which causes unhandled rejections in Vitest
> and in the browser console . Fix by attaching a no-op .catch() to those
> fire-and-forget calls; leave execute / refetch unchanged for callers that
> await and handle errors.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]