From 23dcca5527d35402dd0cc187d02484c79195e484 Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Thu, 31 Aug 2023 22:08:18 +0200 Subject: [PATCH] fix: issue with resolving dev environment (#501) * fix: issue with resolving dev environment * fix: revert accidental commtit * chore: version bump --- apps/client/package.json | 2 +- apps/client/src/common/api/apiConstants.ts | 3 ++- apps/client/src/common/utils/socket.ts | 4 ++-- apps/electron/package.json | 2 +- apps/server/package.json | 2 +- package.json | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/client/package.json b/apps/client/package.json index 5989b06858..f926282646 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -1,6 +1,6 @@ { "name": "ontime-ui", - "version": "2.7.0", + "version": "2.7.1", "private": true, "dependencies": { "@chakra-ui/react": "^2.7.0", diff --git a/apps/client/src/common/api/apiConstants.ts b/apps/client/src/common/api/apiConstants.ts index 935a102f14..d94553ac65 100644 --- a/apps/client/src/common/api/apiConstants.ts +++ b/apps/client/src/common/api/apiConstants.ts @@ -12,9 +12,10 @@ export const RUNTIME = ['runtimeStore']; const location = window.location; const socketProtocol = location.protocol === 'https:' ? 'wss' : 'ws'; +export const isProduction = import.meta.env.MODE === 'production'; const STATIC_PORT = 4001; -export const serverPort = import.meta.env.DEV ? STATIC_PORT : location.port; +export const serverPort = isProduction ? location.port : STATIC_PORT; export const serverURL = `${location.protocol}//${location.hostname}:${serverPort}`; export const websocketUrl = `${socketProtocol}://${location.hostname}:${serverPort}/ws`; diff --git a/apps/client/src/common/utils/socket.ts b/apps/client/src/common/utils/socket.ts index 2a54fa16aa..17cee8699a 100644 --- a/apps/client/src/common/utils/socket.ts +++ b/apps/client/src/common/utils/socket.ts @@ -1,6 +1,6 @@ import { Log, RuntimeStore } from 'ontime-types'; -import { RUNTIME, websocketUrl } from '../api/apiConstants'; +import { isProduction, RUNTIME, websocketUrl } from '../api/apiConstants'; import { ontimeQueryClient } from '../queryClient'; import { socketClientName } from '../stores/connectionName'; import { addLog } from '../stores/logger'; @@ -64,7 +64,7 @@ export const connectSocket = (preferredClientName?: string) => { } case 'ontime': { runtime.setState(payload as RuntimeStore); - if (import.meta.env.DEV) { + if (!isProduction) { ontimeQueryClient.setQueryData(RUNTIME, data.payload); } break; diff --git a/apps/electron/package.json b/apps/electron/package.json index 3e8dd5a1b4..9769b2edc6 100644 --- a/apps/electron/package.json +++ b/apps/electron/package.json @@ -1,6 +1,6 @@ { "name": "ontime", - "version": "2.7.0", + "version": "2.7.1", "author": "Carlos Valente", "description": "Time keeping for live events", "repository": "https://github.com/cpvalente/ontime", diff --git a/apps/server/package.json b/apps/server/package.json index 73e5ebf379..5b0b6aacd1 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -2,7 +2,7 @@ "name": "ontime-server", "type": "module", "main": "src/index.ts", - "version": "2.7.0", + "version": "2.7.1", "exports": "./src/index.js", "dependencies": { "body-parser": "^1.20.0", diff --git a/package.json b/package.json index 625ad1cd9b..2fcead2349 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ontime", - "version": "2.7.0", + "version": "2.7.1", "description": "Time keeping for live events", "keywords": [ "lighdev",