xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 9 forks source link

Improve signature of `waitFor` utility function #3825

Closed amcclain closed 2 weeks ago

amcclain commented 2 weeks ago

Currently waitFor(condition: () => boolean, interval: number = 50, timeout: number = 5 * SECONDS) which is a bit unfortunate, as it's much more likely that a dev will want to customize the timeout vs. the interval.

Would be great if we took the latter two in an options object. I think it would be reasonable to do this as a breaking change, since TS should alert developers and I doubt there are all that many usages in the wild.