[
https://issues.apache.org/jira/browse/HDDS-14544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18093906#comment-18093906
]
Anurag Parvatikar edited comment on HDDS-14544 at 7/6/26 6:47 AM:
------------------------------------------------------------------
2 Independent issues combine to produce the observed behaviour.
# *Duplicate API calls per tab endpoint:*
** Each OM DB Insights tab uses the useApiData hook to fetch data. This hook
also refetches the data when there is change in the URL.
** Each tab also defines a separate useEffect hook that refetches the data
through useApiData when limit.value changes.
** By behaviour, changing the limit results in changing the URL. As a result,
we have 2 listeners - one is useApiData listening to changes in URL and the
other in the same Table listening to limit.value changes. This results in 2
calls to useApiData.
** useApiData aborts the first call and then the second call goes through
resulting in the observed behaviour.
# *Changing the limit results in fetching data for all 5 tab endpoints even
though only one tab is active:*
*
** Limit's state lives in the parent and is shared across all tabs.
*
** Ant Design Tabs mounts the tab content on the first visit to a tab. These
tabs remain mounted even when inactive (default behaviour of Ant design tabs).
** Changing the limit, results in changing the state for all tabs which are
mounted, resulting in refetching data for all tabs.
was (Author: JIRAUSER298512):
2 Independent issues combine to produce the observed behaviour.
# *Duplicate API calls per tab endpoint:*
** Each OM DB Insights tab uses the useApiData hook to fetch data. This hook
also refetches the data when there is change in the URL.
** Each tab also defines a separate useEffect hook that refetches the data
through useApiData when limit.value changes.
** By behaviour, changing the limit results in changing the URL. As a result,
we have 2 listeners - one is useApiData listening to changes in URL and the
other in the same Table listening to limit.value changes. This results in 2
calls to useApiData.
** useApiData aborts the first call and then the second call goes through
resulting in the observed behaviour.
# *Changing the limit results in fetching data for all 5 tab endpoints even
though only one tab is active:*
*
** Limit's state lives in the parent and is shared across all tabs.
** Ant Design Tabs mounts the tab content on the first visit to a tab. These
tabs remain mounted even when inactive (default behaviour of Ant design tabs).
** Changing the limit, results in changing the state for all tabs which are
mounted, resulting in refetching data for all tabs.
> OM DB Insights: Duplicate API calls triggered when changing limit selector
> --------------------------------------------------------------------------
>
> Key: HDDS-14544
> URL: https://issues.apache.org/jira/browse/HDDS-14544
> Project: Apache Ozone
> Issue Type: Bug
> Components: Ozone Recon
> Reporter: Arafat Khan
> Assignee: Anurag Parvatikar
> Priority: Major
> Labels: newbie
>
> When changing the limit selector on the OM DB Insights page, duplicate API
> calls are being made for each endpoint, with the first call getting cancelled
> immediately.
> *Steps to Reproduce:*
> # Navigate to OM DB Insights page
> # Open the limit dropdown
> # Select any limit value (e.g., 5000)
> # Observe network calls in browser DevTools
> *Expected Behavior:*
> * One API call should be made for the active tab with the selected limit
> value
> * Example:
> {code:java}
> GET /api/v1/containers/mismatch?limit=5000&missingIn=OM {code}
> *Actual Behavior:*
> * Two API calls are made for each endpoint
> * First call gets cancelled: (canceled)
> {code:java}
> GET /api/v1/containers/mismatch?limit=1000{code}
> * Second call completes: (200 OK)
> {code:java}
> GET /api/v1/containers/mismatch?limit=1000 {code}
> * This happens for all 5 tab endpoints even though only one tab is active
> *Impact:*
> * Unnecessary network traffic and Performance degradation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]