Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit d5a761f

Browse files
committed
fix(packages/core): command history model should revert to eliding back-to-back duplicates
Fixes #5701
1 parent a16767a commit d5a761f

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

packages/core/src/models/history.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
import Debug from 'debug'
1818
import store from './store'
19-
import KResponse from './command'
20-
import { ResponseType } from '../repl/events'
2119

2220
/** Legacy localStorage key for long-time Kui users */
2321
const legacyKey = 'openwhisk.history'
@@ -36,14 +34,6 @@ type FilterFunction = (line: HistoryLine) => boolean
3634
export interface HistoryLine {
3735
/** The raw command line */
3836
raw: string
39-
40-
/** The output of that command line's execution */
41-
response?: KResponse
42-
responseType?: ResponseType
43-
execUUID?: string
44-
45-
/** Index into model */
46-
historyIdx: number
4737
}
4838

4939
/** A tuple of History entries, one per Tab (as specified by its given uuid) */
@@ -154,9 +144,9 @@ export class HistoryModel {
154144

155145
/** add a line of repl history */
156146
public add(line: Pick<HistoryLine, 'raw'>): number {
157-
if (this._lines.length === 0 || JSON.stringify(this._lines[this._lines.length - 1]) !== JSON.stringify(line)) {
147+
if (this._lines.length === 0 || this._lines[this._lines.length - 1].raw !== line.raw) {
158148
// don't add sequential duplicates
159-
this._lines.push(Object.assign(line, { historyIdx: this._lines.length - 1 }))
149+
this._lines.push(line)
160150
this.save()
161151
// console.log('history::add', cursor)
162152
}

0 commit comments

Comments
 (0)