eBay / ebayui-core-react

eBayUI React components
https://opensource.ebay.com/ebayui-core-react/main/
MIT License
28 stars 31 forks source link

fix: dialog document attach event timeout #300

Closed FiodorGherasimenco closed 10 months ago

FiodorGherasimenco commented 10 months ago

Issue related to react 18.2.0 witch will cause baseDialog to invoke useEffect when updating state for the content inside dialog. It may happen that attach document click will happen after call cleanup inside useEffect.

Fix: clean timeout each time when useEffect cals cleanup.

FiodorGherasimenco commented 10 months ago

Same issue may happen as in demo when there is more then one dialog on page.

FiodorGherasimenco commented 10 months ago

Thank you for the PR but we can’t do this change. This will break the current behavior on clicking outside of the page. As you can see the test were failing, we should not modify that test. We will need to have a different solution. Did you try to use event.stopPropagation() in your on background click?

stopPropagation will prevent click on close button so its also not a solution.

I will take a look on solution without modifying tests.

oxala commented 10 months ago

Ops, sorry, wrong place for approval. Don't mind me. 🤐