diff --git a/mattermost-plugin/webapp/src/index.tsx b/mattermost-plugin/webapp/src/index.tsx index d02eb7095..6906913c0 100644 --- a/mattermost-plugin/webapp/src/index.tsx +++ b/mattermost-plugin/webapp/src/index.tsx @@ -66,7 +66,6 @@ type Props = { } const MainApp = (props: Props) => { - const [faviconStored, setFaviconStored] = useState(false) wsClient.initPlugin(manifest.id, props.webSocketClient) useEffect(() => { @@ -84,24 +83,11 @@ const MainApp = (props: Props) => { } }, []) - useEffect(() => { - const oldLinks = document.querySelectorAll("link[rel*='icon']") as NodeListOf - if (!oldLinks) { - return () => null - } - setFaviconStored(true) - - return () => { - document.querySelectorAll("link[rel*='icon']").forEach((n) => n.remove()) - oldLinks.forEach((link) => document.getElementsByTagName('head')[0].appendChild(link)) - } - }, []) - return (
- {faviconStored && } +
diff --git a/webapp/src/utils.ts b/webapp/src/utils.ts index ecb9cdb98..b4cb50fd5 100644 --- a/webapp/src/utils.ts +++ b/webapp/src/utils.ts @@ -247,6 +247,11 @@ class Utils { // favicon static setFavicon(icon?: string): void { + if (Utils.isFocalboardPlugin()) { + // Do not change the icon from focalboard plugin + return + } + if (!icon) { document.querySelector("link[rel*='icon']")?.remove() return