Harden Crisp chat widget load and report failures to PostHog#776
Closed
posthog[bot] wants to merge 1 commit into
Closed
Harden Crisp chat widget load and report failures to PostHog#776posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The Crisp chat widget was injected in src/theme/Root.tsx with no load-failure handling, so when Crisp's backend is slow or unreachable it surfaced a raw "Request timeout" to docs readers that followed them across pages. Guard the script load with an onerror handler and a load timeout so a failed load degrades quietly (removes the dangling script) instead of showing a raw timeout. Also report the failure via PostHog's captureException so we can quantify how often Crisp fails to load, since the docs site currently captures no $exception events. Generated-By: PostHog Code Task-Id: 8b4922b2-08fa-46d0-8d38-31881bfb123b
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
|
This PR was closed because it has been inactive for 1 day since being marked as stale. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Crisp chat widget is injected globally in
src/theme/Root.tsxwith no load-failure handling. When Crisp's backend is slow or unreachable, the widget surfaces a raw "Request timeout" message to docs readers, and because it's mounted at the app root, that message follows the reader across pages.This PR:
onerrorhandler and a 15s load timeout. On failure we remove the dangling<script>so the widget degrades quietly instead of showing a raw timeout.posthog.captureException(injected globally byposthog-docusaurus). The docs site currently captures no$exceptionevents, so we had zero visibility into how often Crisp fails — this lets us quantify it before deciding whether it warrants more work.Why
A recorded session showed a reader hit the same "Request timeout" from the Crisp widget across multiple docs pages. The docs content itself stayed usable, so this is an annoyance rather than a broken flow — but with no error instrumentation we couldn't tell whether it was one flaky moment or a widespread pattern. This hardens the failure path and adds the measurement.
Created with PostHog Code from an inbox report.