Skip to content

Commit

Permalink
console: Fix update application lastSeen
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaplots committed Sep 13, 2024
1 parent ee7c2e9 commit 328a882
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/webui/console/store/reducers/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ const applications = (state = defaultState, { type, payload, event, meta }) => {
if (EVENT_END_DEVICE_HEARTBEAT_FILTERS_REGEXP.test(event.name)) {
const lastSeen = getByPath(event, 'data.received_at') || event.time
const id = getApplicationId(event.identifiers[0].device_ids)

// Update the application's derived last seen value, if the current
// heartbeat event is more recent than the currently stored one.
if (!(id in state.derived) || lastSeen > state.derived[id].lastSeen) {
if (
!(id in state.derived) ||
!state.derived[id].lastSeen ||
lastSeen > state.derived[id].lastSeen
) {
return {
...state,
derived: {
Expand Down

0 comments on commit 328a882

Please sign in to comment.