fix: Revert PWA features to restore stability and fix loading freeze in UserContext

This commit is contained in:
Marcio Bevervanso 2026-02-17 20:58:23 -03:00
parent b7c121a084
commit fe7dabf76d
5 changed files with 4 additions and 49 deletions

View file

@ -5,9 +5,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#059669" />
<link rel="apple-touch-icon" href="/pwa-192x192.png" />
<link rel="mask-icon" href="/vite.svg" color="#059669" />
<!-- Primary Meta Tags --> <!-- Primary Meta Tags -->
<title>FoodSnap.ai - Nutricionista de Bolso com Inteligência Artificial</title> <title>FoodSnap.ai - Nutricionista de Bolso com Inteligência Artificial</title>
<meta name="title" content="FoodSnap.ai - Nutricionista de Bolso com Inteligência Artificial" /> <meta name="title" content="FoodSnap.ai - Nutricionista de Bolso com Inteligência Artificial" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View file

@ -80,6 +80,8 @@ export const UserProvider: React.FC<{ children: ReactNode }> = ({ children }) =>
} catch (error) { } catch (error) {
console.error('UserContext: Erro ao carregar perfil', error); console.error('UserContext: Erro ao carregar perfil', error);
setUser(null); setUser(null);
} finally {
setLoading(false);
} }
}; };

View file

@ -1,7 +1,6 @@
import path from 'path'; import path from 'path';
import { defineConfig, loadEnv } from 'vite'; import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
const env = loadEnv(mode, '.', ''); const env = loadEnv(mode, '.', '');
@ -10,51 +9,7 @@ export default defineConfig(({ mode }) => {
port: 3000, port: 3000,
host: '0.0.0.0', host: '0.0.0.0',
}, },
plugins: [ plugins: [react()],
react(),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto', // Re-enable SW for installation criteria
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'],
manifest: {
name: 'FoodSnap.ai',
short_name: 'FoodSnap',
description: 'Nutricionista de Bolso com Inteligência Artificial',
theme_color: '#059669',
background_color: '#ffffff',
display: 'standalone',
orientation: 'portrait',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
]
},
workbox: {
// NetworkOnly strategy to prevent caching issues/lag but allow installation
runtimeCaching: [{
urlPattern: ({ request }) => request.destination === 'document' || request.destination === 'script' || request.destination === 'style' || request.destination === 'image',
handler: 'NetworkOnly',
}],
cleanupOutdatedCaches: true,
skipWaiting: true,
clientsClaim: true,
}
})
],
define: { define: {
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY), 'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY) 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)