Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace API polling with browser-native "online" status check #326

Merged
merged 6 commits into from
Jun 28, 2024

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Jun 27, 2024

Previously we would poll the Chromatic API every 5 seconds to check for service availability (and internet connection). This floods our GraphQL API with needless requests, so we decided to remove that polling behavior.

To cover the most likely scenario of no internet connection, the browser online and offline events are used to get notified of connection issues.

📦 Published PR as canary version: 1.6.0--canary.326.58371ad.0

✨ Test out this PR locally via:

npm install @chromatic-com/[email protected]
# or 
yarn add @chromatic-com/[email protected]

@ghengeveld ghengeveld added release Auto: Create a `latest` release when merged minor Auto: Increment the minor version when merged labels Jun 27, 2024
src/preset.ts Outdated Show resolved Hide resolved
@ghengeveld ghengeveld added patch Auto: Increment the patch version when merged and removed minor Auto: Increment the minor version when merged labels Jun 27, 2024
@ghengeveld ghengeveld requested a review from tevanoff June 27, 2024 21:51
Copy link

@tevanoff tevanoff left a comment

Choose a reason for hiding this comment

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

I haven't QA'd but code looks good!

@ghengeveld ghengeveld changed the title Reduce API polling and improve "online" status check Replace API polling with browser-native "online" status check Jun 28, 2024
@ghengeveld ghengeveld merged commit 7e4db43 into main Jun 28, 2024
8 checks passed
@ghengeveld ghengeveld deleted the avoid-excessive-polling branch June 28, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Auto: Increment the patch version when merged release Auto: Create a `latest` release when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants