@learnpack/learnpack 5.0.295 → 5.0.296

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/ui/_app/sw.js CHANGED
@@ -21,15 +21,39 @@ self.addEventListener('install', (event) => {
21
21
  });
22
22
 
23
23
  self.addEventListener('fetch', (event) => {
24
- // Excluir solicitudes a /socket.io/
25
- if (event.request.url.includes('/socket.io/')) {
26
- // No interceptar, que siga el flujo normal
24
+ // Excluir solicitudes a /socket.io/ y otras URLs que no deben ser cacheadas
25
+ if (event.request.url.includes('/socket.io/') ||
26
+ event.request.url.includes('/api/') ||
27
+ event.request.url.includes('localhost') ||
28
+ event.request.url.includes('devtunnels')) {
27
29
  return;
28
30
  }
29
31
 
30
32
  event.respondWith(
31
33
  caches.match(event.request).then((response) => {
32
- return response || fetch(event.request);
34
+ if (response) {
35
+ return response;
36
+ }
37
+
38
+ // Solo hacer fetch para recursos estáticos
39
+ if (event.request.method === 'GET' &&
40
+ (event.request.url.includes('.js') ||
41
+ event.request.url.includes('.css') ||
42
+ event.request.url.includes('.png') ||
43
+ event.request.url.includes('.jpg') ||
44
+ event.request.url.includes('.ico') ||
45
+ event.request.url.includes('.svg'))) {
46
+ return fetch(event.request).catch(() => {
47
+ // Si falla el fetch, devolver una respuesta básica
48
+ return new Response('Resource not available', { status: 404 });
49
+ });
50
+ }
51
+
52
+ // Para otras solicitudes, no interceptar
53
+ return fetch(event.request);
54
+ }).catch(() => {
55
+ // En caso de error, devolver respuesta básica
56
+ return new Response('Service worker error', { status: 500 });
33
57
  })
34
58
  );
35
59
  });
package/src/ui/app.tar.gz CHANGED
Binary file