Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Implement different hydration techniques #12

Closed
luisherranz opened this issue May 9, 2022 · 0 comments · Fixed by #14
Closed

Implement different hydration techniques #12

luisherranz opened this issue May 9, 2022 · 0 comments · Fixed by #14
Assignees

Comments

@luisherranz
Copy link
Member

This one should be pretty straightforward.

We could use a data-gutenberg-hydrate="technique" with values load, idle and view for now.

Something like:

const technique = this.getAttribute("data-gutenberg-hydrate");

const hydrate = () => {...};

switch (technique) {
  case "idle":
    requestIdleCallback(hydrate)
    break;
  case "view":
    onInteresect(this, hydrate)
    break;
  default:
    hydrate();
}

For reference, Astro's code is here: https://github.com/withastro/astro/tree/main/packages/astro/src/runtime/client.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants