mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-25 04:49:38 +00:00
fix(frontend): Fix PWA caching system, remove prompts.
This commit is contained in:
@@ -1,31 +1,10 @@
|
||||
import { createRootRoute, Outlet } from "@tanstack/react-router";
|
||||
import { AppSidebar } from "../components/AppSidebar";
|
||||
import { SiteHeader } from "../components/SiteHeader";
|
||||
import { PWAInstallPrompt, PWAUpdatePrompt } from "../components/PWAPrompts";
|
||||
import { usePWA } from "../hooks/usePWA";
|
||||
import { useVersionCheck } from "../hooks/useVersionCheck";
|
||||
import { SidebarInset, SidebarProvider } from "../components/ui/sidebar";
|
||||
import { Toaster } from "../components/ui/sonner";
|
||||
|
||||
function RootLayout() {
|
||||
const { updateAvailable, updateSW, forceReload } = usePWA();
|
||||
|
||||
// Check for version mismatches and force reload if needed
|
||||
useVersionCheck(forceReload);
|
||||
|
||||
const handlePWAInstall = () => {
|
||||
console.log("PWA installed successfully");
|
||||
};
|
||||
|
||||
const handlePWAUpdate = async () => {
|
||||
try {
|
||||
await updateSW();
|
||||
console.log("PWA updated successfully");
|
||||
} catch (error) {
|
||||
console.error("Error updating PWA:", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<SidebarProvider
|
||||
style={
|
||||
@@ -43,13 +22,6 @@ function RootLayout() {
|
||||
</main>
|
||||
</SidebarInset>
|
||||
|
||||
{/* PWA Prompts */}
|
||||
<PWAInstallPrompt onInstall={handlePWAInstall} />
|
||||
<PWAUpdatePrompt
|
||||
updateAvailable={updateAvailable}
|
||||
onUpdate={handlePWAUpdate}
|
||||
/>
|
||||
|
||||
{/* Toast Notifications */}
|
||||
<Toaster />
|
||||
</SidebarProvider>
|
||||
|
||||
Reference in New Issue
Block a user