Skip to content

Commit d137ee7

Browse files
authored
fix: Bind this to utils that moved from static to non-static with js api de-globalization (#1795)
I noticed this issue while investigating deephaven/deephaven-plugins#179 and switching a param of `(v) => this.chartUtils.unwrapValue(v)` to just `this.chartUtils.unwrapValue` Looked through the other de-globalization PRs and added `bindAllMethods` to any classes where there were some static methods moved to non-static so that they can be used this way
1 parent fa3a33d commit d137ee7

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

packages/chart/src/ChartUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import type {
3434
OhlcData,
3535
MarkerSymbol,
3636
} from 'plotly.js';
37-
import { assertNotNull, Range } from '@deephaven/utils';
37+
import { assertNotNull, bindAllMethods, Range } from '@deephaven/utils';
3838
import { ChartTheme } from './ChartTheme';
3939

4040
export type FilterColumnMap = Map<
@@ -548,6 +548,7 @@ class ChartUtils {
548548
constructor(dh: DhType) {
549549
this.dh = dh;
550550
this.daysOfWeek = Object.freeze(dh.calendar.DayOfWeek.values());
551+
bindAllMethods(this);
551552
}
552553

553554
/**

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
611611
this.handleGotoValueSelectedFilterChanged.bind(this);
612612
this.handleGotoValueChanged = this.handleGotoValueChanged.bind(this);
613613
this.handleGotoValueSubmitted = this.handleGotoValueSubmitted.bind(this);
614+
this.makeQuickFilter = this.makeQuickFilter.bind(this);
614615

615616
this.grid = null;
616617
this.lastLoadedConfig = null;

packages/iris-grid/src/IrisGridUtils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ import {
2828
FormattingRule,
2929
} from '@deephaven/jsapi-utils';
3030
import Log from '@deephaven/log';
31-
import { assertNotNull, EMPTY_ARRAY, EMPTY_MAP } from '@deephaven/utils';
31+
import {
32+
assertNotNull,
33+
bindAllMethods,
34+
EMPTY_ARRAY,
35+
EMPTY_MAP,
36+
} from '@deephaven/utils';
3237
import AggregationUtils from './sidebar/aggregations/AggregationUtils';
3338
import AggregationOperation from './sidebar/aggregations/AggregationOperation';
3439
import { FilterData, IrisGridProps, IrisGridState } from './IrisGrid';
@@ -1144,6 +1149,7 @@ class IrisGridUtils {
11441149
constructor(dh: DhType) {
11451150
this.dh = dh;
11461151
this.tableUtils = new TableUtils(dh);
1152+
bindAllMethods(this);
11471153
}
11481154

11491155
/**

packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
159159
constructor(irisGrid: IrisGrid, dh: DhType) {
160160
super();
161161

162+
this.getNumberValueEqualsFilter =
163+
this.getNumberValueEqualsFilter.bind(this);
164+
this.getFilterValueForNumberOrChar =
165+
this.getFilterValueForNumberOrChar.bind(this);
166+
162167
this.debouncedUpdateCustomFormat = debounce(
163168
irisGrid.handleFormatSelection,
164169
DEBOUNCE_UPDATE_FORMAT

packages/iris-grid/src/sidebar/ChartBuilder.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {
1616
SeriesPlotStyle,
1717
} from '@deephaven/jsapi-types';
1818
import Log from '@deephaven/log';
19+
import { bindAllMethods } from '@deephaven/utils';
1920
import shortid from 'shortid';
2021
import {
2122
BarIcon,
@@ -105,15 +106,7 @@ class ChartBuilder extends PureComponent<ChartBuilderProps, ChartBuilderState> {
105106
constructor(props: ChartBuilderProps) {
106107
super(props);
107108

108-
this.handleAddSeries = this.handleAddSeries.bind(this);
109-
this.handleLinkStateChange = this.handleLinkStateChange.bind(this);
110-
this.handleReset = this.handleReset.bind(this);
111-
this.handleSeriesChange = this.handleSeriesChange.bind(this);
112-
this.handleSeriesDeleteClick = this.handleSeriesDeleteClick.bind(this);
113-
this.handleSubmit = this.handleSubmit.bind(this);
114-
this.handleTypeClick = this.handleTypeClick.bind(this);
115-
this.handleXAxisChange = this.handleXAxisChange.bind(this);
116-
this.sendChange = this.sendChange.bind(this);
109+
bindAllMethods(this);
117110

118111
const { model } = props;
119112
const { columns, dh } = model;

0 commit comments

Comments
 (0)