Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

refactor: replace time-based polling with Chatwoot builtin event#188

Merged
productdevbook merged 1 commit intoproductdevbook:mainfrom
shellhub-io:refactor/chatwoot-ready-event
Feb 20, 2025
Merged

refactor: replace time-based polling with Chatwoot builtin event#188
productdevbook merged 1 commit intoproductdevbook:mainfrom
shellhub-io:refactor/chatwoot-ready-event

Conversation

@gustavosbarreto
Copy link
Copy Markdown
Contributor

Description

Replaced the time-based polling mechanism with a Chatwoot builtin event listener for detecting readiness. Introduced isReady and waitForReady utility to ensure Chatwoot API calls are made only after initialization

Additional context

This also fixes an occasional bug where observer.value.observe fails with TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'. The error occurred because document.querySelector('.woot-widget-holder') sometimes returned null, causing startObserver to initialize with an invalid node.

Replaced the time-based polling mechanism with a Chatwoot builtin event
listener for detecting readiness. Introduced `isReady` and `waitForReady`
utility to ensure Chatwoot API calls are made only after initialization

This also fixes an occasional bug where `observer.value.observe` fails
with `TypeError: Failed to execute 'observe' on 'MutationObserver':
parameter 1 is not of type 'Node'`. The error occurred because
`document.querySelector('.woot-widget-holder')` sometimes returned
`null`, causing `startObserver` to initialize with an invalid node.
@gustavosbarreto gustavosbarreto force-pushed the refactor/chatwoot-ready-event branch from fa85a37 to 4291235 Compare February 14, 2025 14:20
@productdevbook productdevbook self-requested a review February 20, 2025 09:20
@productdevbook
Copy link
Copy Markdown
Owner

Thank you ❤️

@productdevbook productdevbook merged commit cd012bc into productdevbook:main Feb 20, 2025
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 this pull request may close these issues.

2 participants