mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +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";
|
||||
|
||||
let customHeadLoaded = false;
|
||||
|
||||
function CustomHead(props) {
|
||||
useEffect(() => {
|
||||
if (!sessionStorage.getItem("customHead")) {
|
||||
if (!customHeadLoaded) {
|
||||
const suffix = new Date().getTime().toString();
|
||||
|
||||
if (!props.headerHtml) {return;}
|
||||
@ -40,7 +42,7 @@ function CustomHead(props) {
|
||||
}
|
||||
document.head.appendChild(innerNode);
|
||||
});
|
||||
sessionStorage.setItem("customHead", "true");
|
||||
customHeadLoaded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user