rusackas commented on PR #35218: URL: https://github.com/apache/superset/pull/35218#issuecomment-5012330668
Checked the new commits — still not there. `handleOnSearch` gets a fresh `debounce()` every render, so wrapping it in `useMemo(() => handleOnSearch, [handleOnSearch])` doesn't stabilize anything, and `.cancel()` is still called in the effect body, not a cleanup `return`. The new test asserts `onSearch` IS called with '1234' after `unmount()` which is the bug we're trying to kill, not the fix. Memoize the `debounce()` call itself on its real closure deps, cancel it in `useEffect(() => () => handleOnSearch.cancel(), [handleOnSearch])`, and flip the test to assert it's NOT called post-unmount. Holler if you want me to push some commits... happy to. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
