123123213weqw opened a new pull request, #6837: URL: https://github.com/apache/rocketmq-dashboard/pull/6837
Fixes #6412. `useVisiblePolling` scheduled polls through `Promise.resolve().then(poll)`: cleanup removed the timer and the visibility listener, but nothing could cancel a microtask already queued — so disabling live refresh, changing the callback, or unmounting in the window between the scheduling event and the queued callback still started the obsolete request, and visibility was only checked before queuing, not when the callback actually ran. The effect now owns a `cancelled` flag set in cleanup, and the queued wrapper re-validates at execution time: a suppressed poll bails out (and still releases the in-flight guard via the existing `finally`) when the effect is gone, polling is disabled, or the page is no longer visible. The overlap guard, timer and listener logic are untouched. Three red-first regression tests (each fails on the base hook): queued poll does not run after unmount, does not run after polling is disabled, and does not run when the page hides before the queued callback executes — the last also asserts the guard is released so the next visible event polls again. Suite is 8/8; lint clean. -- 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]
