Skip to content

Commit 0368f9d

Browse files
committed
opt: opt executeAction
1 parent b66b6ce commit 0368f9d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Chart.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,14 @@ export default class ChartImp implements Chart {
11111111
return isArray(coordinates) ? points : (points[0] ?? {})
11121112
}
11131113

1114-
executeAction (type: ActionType, data: Crosshair): void {
1114+
executeAction (type: ActionType, data: Nullable<Crosshair>): void {
11151115
switch (type) {
11161116
case 'onCrosshairChange': {
1117-
const crosshair: Crosshair = { ...data }
1118-
crosshair.paneId ??= PaneIdConstants.CANDLE
1117+
let crosshair: Nullable<Crosshair> = null
1118+
if (isValid(data)) {
1119+
crosshair = { ...data }
1120+
crosshair.paneId ??= PaneIdConstants.CANDLE
1121+
}
11191122
this._chartStore.setCrosshair(crosshair, { notExecuteAction: true })
11201123
break
11211124
}

src/Store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ export default class StoreImp implements Store {
10901090
}
10911091

10921092
setCrosshair (
1093-
crosshair?: Crosshair,
1093+
crosshair?: Nullable<Crosshair>,
10941094
options?: { notInvalidate?: boolean, notExecuteAction?: boolean, forceInvalidate?: boolean }
10951095
): void {
10961096
const { notInvalidate, notExecuteAction, forceInvalidate } = options ?? {}

0 commit comments

Comments
 (0)