From f5a0a239bb2d4821d454662ad8fd172318b256b1 Mon Sep 17 00:00:00 2001 From: Sleiter <33386189+JoseSleiter@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:51:23 -0400 Subject: [PATCH] Update insertScript this patch, its because if the script was creating in a react app before user is login, them when the user is into the app the script insertion will be duplicate. --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 4897990..54a6c62 100644 --- a/src/index.js +++ b/src/index.js @@ -31,6 +31,10 @@ export default class Zendesk extends Component { } insertScript (zendeskKey, defer) { + const wasCreate = document.getElementById('ze-snippet') + if(wasCreate !== null){ + wasCreate.remove() + } const script = document.createElement('script') if (defer) { script.defer = true