react-live-chat-loader icon indicating copy to clipboard operation
react-live-chat-loader copied to clipboard

Add maxIdlePeriod

Open Nedomas opened this issue 1 year ago • 4 comments

Hi!

Thanks for a great package.

This PR adds maxIdlePeriod that forces provider to load on browsers that support requestIdleCallback but do not manage to call it in reasonable time (defaults at 5s). This introduces a workaround for when the requestIdleCallback is never called because of infinite animations etc.

P.S. Have this published at @nedomas/[email protected] in npm in case it takes longer to review/push new official version.

Nedomas avatar May 07 '24 23:05 Nedomas

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-live-chat-loader ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2024 11:56pm

vercel[bot] avatar May 07 '24 23:05 vercel[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 07 '24 23:05 CLAassistant

Hey @Nedomas, thanks for submitting the PR.

During review we discussed if this change is viable for the library.

After all, the design of the library is that third parties aren't needlessly loaded if the user hasn't indicated to use it (by hovering over the widget init button), or finally if the page has been idle for a reasonable amount of time.

The question to be asked here is: If the page is never idle AND the user doesn't interact with the widget, why would we load it?

The change in this PR adds maxIdlePeriod to simply load when the deadline timer is reached (with a default of 5 seconds), which means third parties would always load after 5 seconds.

benschwarz avatar May 14 '24 00:05 benschwarz

Hi @benschwarz thanks for the response! And yeah, I understand your point.

For me personally, there are two reasons why I need this:

  1. I’m loading widgets in page that never becomes idle (inside Shopify adming embedded env which constantly pings home, so it never idles properly).
  2. Automations like showing an onboarding message on first visit or some other automation defined in HelpScout or Intercom will never run unless the user interacts with the widget. This is not always the desired behaviour. In my case, it makes sense for some automations to run without user interaction.

Just my 2 cents. Thanks for the lib!

Nedomas avatar May 14 '24 01:05 Nedomas