"Enhance loading experience and optimize theme application
Added a fallback background and a preload lock for smoother loading transitions. Improved theme application by applying it prior to React rendering and removed theme flash. Adjusted Service Worker registration for better performance and reliability."
This commit is contained in:
1 parent
070057afb3
commit
7c4754e506
2 files changed
+55
-12
No files matched your search
+13
-7
@@ -4,6 +4,7 @@ import App from "./App.jsx";
|
||||
import { applyTheme, DEFAULT_THEME_KEY } from "./styles/themes";
|
||||
import { registerSW } from "virtual:pwa-register";
|
||||
|
||||
// ✅ Theme VOR React setzen (kein Theme-Flash)
|
||||
try {
|
||||
const key = localStorage.getItem("hpTheme:guest") || DEFAULT_THEME_KEY;
|
||||
applyTheme(key);
|
||||
@@ -11,12 +12,17 @@ try {
|
||||
applyTheme(DEFAULT_THEME_KEY);
|
||||
}
|
||||
|
||||
// ✅ Preload Unlock (nach Theme!)
|
||||
document.body.classList.remove("preload");
|
||||
document.body.classList.add("ready");
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
|
||||
registerSW({ immediate: true });
|
||||
|
||||
// ✅ Service Worker NUR EINMAL registrieren
|
||||
const updateSW = registerSW({
|
||||
immediate: true,
|
||||
onNeedRefresh() {
|
||||
updateSW(true); // sofort neue Version aktivieren
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
immediate: true,
|
||||
onNeedRefresh() {
|
||||
updateSW(true);
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user