Skip to content

Commit

Permalink
fix: correct expiration logic
Browse files Browse the repository at this point in the history
Cards should expire at any update, not only when legs change.
  • Loading branch information
vesameskanen committed Dec 22, 2024
1 parent 3730d5a commit efe4008
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/component/itinerary/navigator/NaviCardContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ function NaviCardContainer(
focusToLeg?.(currentLeg);
}
}
if (incomingMessages.size || legChanged) {
if (incomingMessages.size) {
// Handle messages when new messages arrives.

// Current active messages. Filter away expired messages.
const previousValidMessages = legChanged
? activeMessages.filter(m => !m.expiresOn || m.expiresOn > time)
: activeMessages;
const previousValidMessages = activeMessages.filter(
m => !m.expiresOn || m.expiresOn > time,
);

// handle messages that are updated.
const keptMessages = previousValidMessages.filter(
Expand Down

0 comments on commit efe4008

Please sign in to comment.