Skip to content

Commit b9e77a5

Browse files
committed
fix: load embed.js
1 parent 6b19d65 commit b9e77a5

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/root.component.jsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
import React, { useLayoutEffect } from "react";
2-
import {
3-
disableSidebarForRoute,
4-
setNotificationPlatform,
5-
PLATFORM,
6-
} from "@topcoder/micro-frontends-navbar-app";
1+
import React, { useEffect } from "react";
72
import { VANILLA_EMBED_JS } from "./constants";
83
import "styles/global.scss";
94

105
export default function Root() {
11-
useLayoutEffect(() => {
12-
// disableSidebarForRoute(`${APP_BASE_PATH}/*`);
13-
// setNotificationPlatform(PLATFORM.TAAS);
6+
useEffect(() => {
7+
// embed.js
8+
const script = document.createElement("script");
9+
script.src = VANILLA_EMBED_JS;
10+
script.async = true;
11+
document.body.appendChild(script);
12+
return () => {
13+
document.body.removeChild(script);
14+
};
1415
}, []);
1516

1617
return (
1718
<>
18-
<script type="text/javascript" src={VANILLA_EMBED_JS}></script>
19+
<div id="vanilla-comments"></div>
1920
<noscript>
2021
Please enable JavaScript to view the
2122
<a href="http://vanillaforums.com/?ref_noscript">
2223
discussions powered by Vanilla.
2324
</a>
2425
</noscript>
25-
<div class="vanilla-credit">
26-
<a class="vanilla-anchor" href="http://vanillaforums.com">
27-
Discussions by <span class="vanilla-logo">Vanilla</span>
26+
<div className="vanilla-credit">
27+
<a className="vanilla-anchor" href="http://vanillaforums.com">
28+
Discussions by <span className="vanilla-logo">Vanilla</span>
2829
</a>
2930
</div>
3031
</>

0 commit comments

Comments
 (0)