diff --git a/src/renderer/components/dock/pod-logs.store.ts b/src/renderer/components/dock/pod-logs.store.ts index 421bfeac27..1cff25c80c 100644 --- a/src/renderer/components/dock/pod-logs.store.ts +++ b/src/renderer/components/dock/pod-logs.store.ts @@ -15,7 +15,6 @@ export interface IPodLogsData { initContainers: IPodContainer[] showTimestamps: boolean previous: boolean - newLogsSince?: string // Timestamp after which all logs are considered to be new } type TabId = string; @@ -33,6 +32,7 @@ export class PodLogsStore extends DockTabStore { }); @observable logs = observable.map(); + @observable newLogSince = observable.map(); // Timestamp after which all logs are considered to be new constructor() { super({ @@ -118,13 +118,9 @@ export class PodLogsStore extends DockTabStore { * @param tabId */ setNewLogSince(tabId: TabId) { - const data = this.data.get(tabId); - if (data.newLogsSince || !this.logs.has(tabId)) return; - const timestamp = podLogsStore.getLastSinceTime(tabId); - this.setData(tabId, { - ...data, - newLogsSince: timestamp.split(".")[0] // Removing milliseconds from string - }) + if (!this.logs.has(tabId) || this.newLogSince.has(tabId)) return; + const timestamp = this.getLastSinceTime(tabId); + this.newLogSince.set(tabId, timestamp.split(".")[0]); // Removing milliseconds from string } /** diff --git a/src/renderer/components/dock/pod-logs.tsx b/src/renderer/components/dock/pod-logs.tsx index d00809231a..efc3efb30a 100644 --- a/src/renderer/components/dock/pod-logs.tsx +++ b/src/renderer/components/dock/pod-logs.tsx @@ -99,13 +99,13 @@ export class PodLogs extends React.Component { get logs() { if (!podLogsStore.logs.has(this.tabId)) return []; const logs = podLogsStore.logs.get(this.tabId); - const { getData, removeTimestamps } = podLogsStore; - const { showTimestamps, newLogsSince } = getData(this.tabId); + const { getData, removeTimestamps, newLogSince } = podLogsStore; + const { showTimestamps } = getData(this.tabId); let oldLogs = logs; let newLogs = ""; - if (newLogsSince) { + if (newLogSince.has(this.tabId)) { // Finding separator timestamp in logs - const index = logs.indexOf(newLogsSince); + const index = logs.indexOf(newLogSince.get(this.tabId)); if (index !== -1) { // Splitting logs to old and new ones oldLogs = logs.substring(0, index);