From b893ec13ab10188704a1debb39a09ea00d401c53 Mon Sep 17 00:00:00 2001 From: Elena Baidakova Date: Fri, 21 Apr 2023 15:15:01 +0400 Subject: [PATCH] Fixed announcement bar insertion no issue - Checked if react root div was already inserted to avoid duplication. --- ghost/announcement-bar/src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ghost/announcement-bar/src/index.js b/ghost/announcement-bar/src/index.js index 58d4d03a46..987f9a0c2a 100644 --- a/ghost/announcement-bar/src/index.js +++ b/ghost/announcement-bar/src/index.js @@ -6,6 +6,10 @@ import {App} from './App'; const ROOT_DIV_ID = 'announcement-bar-root'; function addRootDiv() { + if (document.getElementById(ROOT_DIV_ID)) { + return; + } + const elem = document.createElement('div'); elem.id = ROOT_DIV_ID; document.body.prepend(elem);