|
|
@@ -18,7 +18,7 @@ const cancelIdleCallback: Window['cancelIdleCallback'] =
|
|
|
* listeners.
|
|
|
*/
|
|
|
export type HydrationStrategy = (
|
|
|
- hydrate: () => void,
|
|
|
+ hydrate: () => void | Promise<any>,
|
|
|
forEachElement: (cb: (el: Element) => any) => void,
|
|
|
) => (() => void) | void
|
|
|
|
|
|
@@ -86,11 +86,12 @@ export const hydrateOnInteraction: HydrationStrategyFactory<
|
|
|
(hydrate, forEach) => {
|
|
|
if (isString(interactions)) interactions = [interactions]
|
|
|
let hasHydrated = false
|
|
|
- const doHydrate = (e: Event) => {
|
|
|
+ const doHydrate = async (e: Event) => {
|
|
|
if (!hasHydrated) {
|
|
|
hasHydrated = true
|
|
|
teardown()
|
|
|
- hydrate()
|
|
|
+ // eslint-disable-next-line no-restricted-syntax
|
|
|
+ await hydrate()
|
|
|
// replay event
|
|
|
e.target!.dispatchEvent(new (e.constructor as any)(e.type, e))
|
|
|
}
|