Stop widget disappearing on page change#1736
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Link check results for preview deployment (https://codat-docs-git-fix-zendesk-messenger-disappearing-codat.vercel.app): |
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| script.onload = () => setIsLoaded(true); | ||
|
|
||
| document.body.appendChild(script); | ||
|
|
There was a problem hiding this comment.
Duplicate script elements added on each page navigation
Removing the cleanup function without adding a guard check causes duplicate Zendesk script elements to be appended to the document body on every page navigation. When the DocItemLayout component remounts after page change, the useEffect runs again and appends a new script since no check exists for whether a script with id="ze-snippet" already exists in the DOM. This can lead to multiple script loads and potential issues with the Zendesk widget.
Description
Removed clean up code causing the widget to disappear
Type of change
Note
Remove cleanup in
useZendeskso the Zendesk widget persists across page navigations instead of disappearing.Written by Cursor Bugbot for commit e015839. This will update automatically on new commits. Configure here.