mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: fix custom JS doesn't reload after refresh bug (#2773)
This commit is contained in:
@ -14,9 +14,11 @@
|
|||||||
|
|
||||||
import {useEffect} from "react";
|
import {useEffect} from "react";
|
||||||
|
|
||||||
|
let customHeadLoaded = false;
|
||||||
|
|
||||||
function CustomHead(props) {
|
function CustomHead(props) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!sessionStorage.getItem("customHead")) {
|
if (!customHeadLoaded) {
|
||||||
const suffix = new Date().getTime().toString();
|
const suffix = new Date().getTime().toString();
|
||||||
|
|
||||||
if (!props.headerHtml) {return;}
|
if (!props.headerHtml) {return;}
|
||||||
@ -40,7 +42,7 @@ function CustomHead(props) {
|
|||||||
}
|
}
|
||||||
document.head.appendChild(innerNode);
|
document.head.appendChild(innerNode);
|
||||||
});
|
});
|
||||||
sessionStorage.setItem("customHead", "true");
|
customHeadLoaded = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user