From 41d6ba31d9e07f787c560dc42de29bd3ff1444a3 Mon Sep 17 00:00:00 2001 From: Kevin Schiffer Date: Wed, 12 Jun 2024 16:51:14 +0200 Subject: [PATCH 1/2] console: Fix mutated state in application reducer --- CHANGELOG.md | 2 ++ pkg/webui/console/store/index.js | 2 +- pkg/webui/console/store/reducers/devices.js | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55da25bbd3..d7fa9375a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ For details about compatibility between different releases, see the **Commitment ### Fixed +- Fix potential issue with application event stream stopping after showing initial events. + ### Security ## [3.30.2] - unreleased diff --git a/pkg/webui/console/store/index.js b/pkg/webui/console/store/index.js index 2b43a4211a..1e0c6e746b 100644 --- a/pkg/webui/console/store/index.js +++ b/pkg/webui/console/store/index.js @@ -49,7 +49,7 @@ const store = configureStore({ ignoredActionPaths: ['meta._resolve', 'meta._reject'], }, }).concat(middlewares), - enhancert: getDefaultEnhancers => getDefaultEnhancers().concat(enhancers), + enhancer: getDefaultEnhancers => getDefaultEnhancers().concat(enhancers), devTools: dev && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__, }) diff --git a/pkg/webui/console/store/reducers/devices.js b/pkg/webui/console/store/reducers/devices.js index 3e187ff9c7..e7612cca23 100644 --- a/pkg/webui/console/store/reducers/devices.js +++ b/pkg/webui/console/store/reducers/devices.js @@ -209,7 +209,7 @@ const devices = (state = defaultState, { type, payload, event }) => { const id = getCombinedDeviceId(event.identifiers[0].device_ids) const receivedAt = getByPath(event, 'data.received_at') if (receivedAt) { - const currentEndDevice = state.entities[id] + const currentEndDevice = { ...state.entities[id] } if (currentEndDevice) { // Only update if the event was actually more recent than the current value. if ( @@ -218,6 +218,14 @@ const devices = (state = defaultState, { type, payload, event }) => { ) { currentEndDevice.last_seen_at = receivedAt } + + return { + ...state, + entities: { + ...state.entities, + [id]: currentEndDevice, + }, + } } } } From b51814add972bba633953ba671acd4c47eed21bc Mon Sep 17 00:00:00 2001 From: Kevin Schiffer Date: Wed, 12 Jun 2024 17:01:25 +0200 Subject: [PATCH 2/2] console,account: Update to redux 5 --- package.json | 2 +- yarn.lock | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 3f20d5f9e6..4f24562384 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "react-toastify": "^9.1.3", "react-virtualized-auto-sizer": "^1.0.24", "react-window": "^1.8.10", - "redux": "^4.2.1", + "redux": "^5.0.1", "redux-actions": "^2.6.5", "redux-logic": "^5.0.1", "reselect": "^5.1.0", diff --git a/yarn.lock b/yarn.lock index 78744307fa..188ecfa17e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1189,7 +1189,7 @@ core-js "^2.6.12" regenerator-runtime "^0.14.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.9", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.9", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.23.9" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7" integrity sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw== @@ -10621,13 +10621,6 @@ redux-thunk@^3.1.0: resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-3.1.0.tgz#94aa6e04977c30e14e892eae84978c1af6058ff3" integrity sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw== -redux@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/redux/-/redux-4.2.1.tgz#c08f4306826c49b5e9dc901dee0452ea8fce6197" - integrity sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w== - dependencies: - "@babel/runtime" "^7.9.2" - redux@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/redux/-/redux-5.0.1.tgz#97fa26881ce5746500125585d5642c77b6e9447b"