Skip to content

(templates): Stop hydrating with requestIdleCallback#667

Merged
juanpprieto merged 2 commits into
2023-01from
@juanpprieto/remove-request-idle-callback
Mar 10, 2023
Merged

(templates): Stop hydrating with requestIdleCallback#667
juanpprieto merged 2 commits into
2023-01from
@juanpprieto/remove-request-idle-callback

Conversation

@juanpprieto
Copy link
Copy Markdown
Contributor

@juanpprieto juanpprieto commented Mar 10, 2023

WHY are these changes introduced?

Hydrating with requestIdleCallback can cause the following issues

  • If a site is loaded within a cross-origin iframe it will cause the site to wait until the user clicks into the iframe to perform hydration.
  • It will defer hydration when a page is loaded in a new tab.
  • It will defer hydration for a really long time when Chrome's Battery Saver mode is on.

Thanks to @developit for highlighting all the above 🙏🏼

TLDR;
https://shopify.slack.com/archives/C04SRS2C10A/p1678401031037239

WHAT is this pull request doing?

Avoid waiting for an idle frame to hydrate the app.

HOW to test your changes?

Demo store should be interactive after this change.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@juanpprieto juanpprieto changed the title Stop hydrating with request idle callback (templates): Stop hydrating with request idle callback Mar 10, 2023
@juanpprieto juanpprieto changed the title (templates): Stop hydrating with request idle callback (templates): Stop hydrating with requestIdleCallback Mar 10, 2023
@juanpprieto juanpprieto requested a review from a team March 10, 2023 00:27
Copy link
Copy Markdown
Contributor

@lordofthecactus lordofthecactus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting thread 💯

Copy link
Copy Markdown

@developit developit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@juanpprieto juanpprieto merged commit a841303 into 2023-01 Mar 10, 2023
@juanpprieto juanpprieto deleted the @juanpprieto/remove-request-idle-callback branch March 10, 2023 14:51
@github-actions github-actions Bot mentioned this pull request Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants