From 69a848daf5a70153884c767e74dbc297df3340d5 Mon Sep 17 00:00:00 2001 From: Carter Date: Mon, 11 Aug 2025 11:22:01 -0600 Subject: [PATCH 1/3] merged staging and switched to master proto --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc7a1ac..ee0e9b7 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", From 85ccecdcdc1906644f7dd80f31cf058dce2ca274 Mon Sep 17 00:00:00 2001 From: Carter Date: Wed, 13 Aug 2025 14:37:38 -0600 Subject: [PATCH 2/3] hotfix: if getting user with team fails, just get the user --- package-lock.json | 2 +- src/app/UserWrapper.tsx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb7d904..0e4f8f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", diff --git a/src/app/UserWrapper.tsx b/src/app/UserWrapper.tsx index 722705e..cb4cdf8 100644 --- a/src/app/UserWrapper.tsx +++ b/src/app/UserWrapper.tsx @@ -82,7 +82,20 @@ export default function UserWrapper(props: Props) { firmware: new Map() }) }).catch(() => { - setGlobal(globalDefault) + userAPI.getUser(user_id).then(user => { + setGlobal({ + user: user ? user : User.create(), + team: globalDefault.team, + as: "", + showErrors: false, + userTeamPermissions: [], + backgroundTasksComplete: false, + firmware: new Map() + }) + }).catch(() => { + setGlobal(globalDefault) + }) + }) .finally(() => { setLoading(false) From aeb93d19d287b37d6c1915eabc59b494ec63ff5c Mon Sep 17 00:00:00 2001 From: Carter Date: Thu, 21 Aug 2025 14:33:22 -0600 Subject: [PATCH 3/3] added cache-busting service-worker and removed caching for service-worker.js (vite uses sw.js) --- nginx.conf | 6 ++++++ public/service-worker.js | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 public/service-worker.js diff --git a/nginx.conf b/nginx.conf index b390bff..1537b32 100644 --- a/nginx.conf +++ b/nginx.conf @@ -71,6 +71,12 @@ http { add_header Cache-Control "no-store, no-cache, must-revalidate"; } + # Force re-cache of old service-worker + location = /service-worker.js { + root /usr/share/nginx/html; # adjust if your build folder is elsewhere + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + # Redirect old /index.html requests to new file location = /index.html { return 301 /indexV2.html; diff --git a/public/service-worker.js b/public/service-worker.js new file mode 100644 index 0000000..6b6a19c --- /dev/null +++ b/public/service-worker.js @@ -0,0 +1,24 @@ +// public/service-worker.js +self.addEventListener('install', () => self.skipWaiting()); + +self.addEventListener('activate', async () => { + // Unregister old CRA SW + const regs = await self.registration.scope ? [self.registration] : await self.clients.getRegistrations(); + for (const reg of regs) { + if (reg && reg.scriptURL.endsWith('service-worker.js')) { + await reg.unregister(); + } + } + + // Clear all caches + if ('caches' in self) { + const keys = await caches.keys(); + for (const key of keys) { + await caches.delete(key); + } + } + + // Reload all clients + const clients = await self.clients.matchAll({ type: 'window' }); + clients.forEach(client => client.navigate(client.url)); +});