Add interval to async utilities to supplement post render checks #408
+247
−35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
Resolves #241
Resolves #393
Why:
If hooks don't render the checks don't run. This makes waiting for side effects or other changes outside of the hook's render lifecycle more difficult.
How:
wait
withwaitFor
interval
option towaitFor
andwaitForValueToChange
Checklist:
I'm having some issues generating the docs to check the changes there. There appears to be an issue with one of dependencies ofThese seems to only be an issue locally. The Netlify preview is generating fine 🤷♂️docz
but I have yet to look into it more closely.I'm also thinking about allowing the functionality to by passing aI've made it opt in for the initial release. Will follow up with a breaking release which enables it by default, adds a default timeout and removed the deprecatedfalsy
value and using this as the default, making this a non breaking change. We could follow this up with a breaking release that removeswait
and changes the default forinterval
to be50ms
. I've also wanted to change the defaulttimeout
to1000ms
for a while now, so I'd probably bundle that into the breaking change too.wait
utility.