yyqdbngt opened a new issue, #2240: URL: https://github.com/apache/rocketmq-dashboard/issues/2240
## Problem `useVisiblePolling` starts a new poll for every interval tick and every `visibilitychange` event without checking whether the previous asynchronous poll is still running. When an API request is slower than the polling interval, requests overlap. Their responses can arrive out of order, overwrite newer page state, and multiply backend load. Returning a rejected promise can also leave an unhandled rejection because the hook intentionally discards the returned promise. ## Reproduction 1. Render a page that uses `useVisiblePolling` while the page is visible. 2. Keep the first polling promise pending longer than `intervalMs`. 3. Advance another interval tick or dispatch `visibilitychange`. 4. Observe that the polling callback is invoked again before the first invocation settles. ## Expected behavior - At most one poll is in flight for a hook instance. - Interval and visibility events should share the same in-flight guard. - The guard should be released after either fulfillment or rejection. - Disabling or unmounting the hook should stop further scheduling. ## Proposed scope Update the shared hook and add focused hook tests for overlapping interval/visibility triggers, rejection recovery, hidden-page behavior, and unmount cleanup. ## Duplicate check Searched open and closed issues and pull requests for `useVisiblePolling`, `overlapping poll`, `poll in flight`, and visibility-triggered polling. No matching implementation was found, and no current pull request targeting `rocketmq-studio` changes the hook. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
