Skip to content

Commit e909bef

Browse files
authored
Merge pull request #4041 from dlabrecq/current
Current prop
2 parents a96f6e1 + 1187add commit e909bef

File tree

13 files changed

+24
-24
lines changed

13 files changed

+24
-24
lines changed

src/routes/components/charts/costChart/costChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CostChartBase extends React.Component<CostChartProps, State> {
7070

7171
public componentDidMount() {
7272
this.initDatum();
73-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
73+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7474
}
7575

7676
public componentDidUpdate(prevProps: CostChartProps) {
@@ -301,7 +301,7 @@ class CostChartBase extends React.Component<CostChartProps, State> {
301301

302302
private handleResize = () => {
303303
const { width } = this.state;
304-
const { clientWidth = 0 } = this.containerRef.current || {};
304+
const { clientWidth = 0 } = this.containerRef?.current || {};
305305

306306
if (clientWidth !== width) {
307307
this.setState({ width: clientWidth });

src/routes/components/charts/costExplorerChart/costExplorerChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CostExplorerChartBase extends React.Component<CostExplorerChartProps, Stat
7474

7575
public componentDidMount() {
7676
this.initDatum();
77-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
77+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7878
}
7979

8080
public componentDidUpdate(prevProps: CostExplorerChartProps) {
@@ -422,7 +422,7 @@ class CostExplorerChartBase extends React.Component<CostExplorerChartProps, Stat
422422

423423
private handleResize = () => {
424424
const { width } = this.state;
425-
const { clientWidth = 0 } = this.containerRef.current || {};
425+
const { clientWidth = 0 } = this.containerRef?.current || {};
426426

427427
if (clientWidth !== width) {
428428
this.setState({ width: clientWidth });

src/routes/components/charts/dailyCostChart/dailyCostChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class DailyCostChartBase extends React.Component<DailyCostChartProps, State> {
7373

7474
public componentDidMount() {
7575
this.initDatum();
76-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
76+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7777
}
7878

7979
public componentDidUpdate(prevProps: DailyCostChartProps) {
@@ -352,7 +352,7 @@ class DailyCostChartBase extends React.Component<DailyCostChartProps, State> {
352352

353353
private handleResize = () => {
354354
const { width } = this.state;
355-
const { clientWidth = 0 } = this.containerRef.current || {};
355+
const { clientWidth = 0 } = this.containerRef?.current || {};
356356

357357
if (clientWidth !== width) {
358358
this.setState({ width: clientWidth });

src/routes/components/charts/dailyTrendChart/dailyTrendChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class DailyTrendChartBase extends React.Component<DailyTrendChartProps, State> {
7676

7777
public componentDidMount() {
7878
this.initDatum();
79-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
79+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
8080
}
8181

8282
public componentDidUpdate(prevProps: DailyTrendChartProps) {
@@ -374,7 +374,7 @@ class DailyTrendChartBase extends React.Component<DailyTrendChartProps, State> {
374374

375375
private handleResize = () => {
376376
const { width } = this.state;
377-
const { clientWidth = 0 } = this.containerRef.current || {};
377+
const { clientWidth = 0 } = this.containerRef?.current || {};
378378

379379
if (clientWidth !== width) {
380380
this.setState({ width: clientWidth });

src/routes/components/charts/historicalCostChart/historicalCostChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class HistoricalCostChartBase extends React.Component<HistoricalCostChartProps,
7171

7272
public componentDidMount() {
7373
this.initDatum();
74-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
74+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7575
}
7676

7777
public componentDidUpdate(prevProps: HistoricalCostChartProps) {
@@ -247,7 +247,7 @@ class HistoricalCostChartBase extends React.Component<HistoricalCostChartProps,
247247

248248
private handleResize = () => {
249249
const { width } = this.state;
250-
const { clientWidth = 0 } = this.containerRef.current || {};
250+
const { clientWidth = 0 } = this.containerRef?.current || {};
251251

252252
if (clientWidth !== width) {
253253
this.setState({ width: clientWidth });

src/routes/components/charts/historicalTrendChart/historicalTrendChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class HistoricalTrendChartBase extends React.Component<HistoricalTrendChartProps
7171

7272
public componentDidMount() {
7373
this.initDatum();
74-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
74+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7575
}
7676

7777
public componentDidUpdate(prevProps: HistoricalTrendChartProps) {
@@ -237,7 +237,7 @@ class HistoricalTrendChartBase extends React.Component<HistoricalTrendChartProps
237237

238238
private handleResize = () => {
239239
const { width } = this.state;
240-
const { clientWidth = 0 } = this.containerRef.current || {};
240+
const { clientWidth = 0 } = this.containerRef?.current || {};
241241

242242
if (clientWidth !== width) {
243243
this.setState({ width: clientWidth });

src/routes/components/charts/historicalUsageChart/historicalUsageChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class HistoricalUsageChartBase extends React.Component<HistoricalUsageChartProps
8484

8585
public componentDidMount() {
8686
this.initDatum();
87-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
87+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
8888
}
8989

9090
public componentDidUpdate(prevProps: HistoricalUsageChartProps) {
@@ -351,7 +351,7 @@ class HistoricalUsageChartBase extends React.Component<HistoricalUsageChartProps
351351

352352
private handleResize = () => {
353353
const { width } = this.state;
354-
const { clientWidth = 0 } = this.containerRef.current || {};
354+
const { clientWidth = 0 } = this.containerRef?.current || {};
355355

356356
if (clientWidth !== width) {
357357
this.setState({ width: clientWidth });

src/routes/components/charts/trendChart/trendChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class TrendChartBase extends React.Component<TrendChartProps, State> {
7373

7474
public componentDidMount() {
7575
this.initDatum();
76-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
76+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7777
}
7878

7979
public componentDidUpdate(prevProps: TrendChartProps) {
@@ -325,7 +325,7 @@ class TrendChartBase extends React.Component<TrendChartProps, State> {
325325

326326
private handleResize = () => {
327327
const { width } = this.state;
328-
const { clientWidth = 0 } = this.containerRef.current || {};
328+
const { clientWidth = 0 } = this.containerRef?.current || {};
329329

330330
if (clientWidth !== width) {
331331
this.setState({ width: clientWidth });

src/routes/components/charts/usageChart/usageChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class UsageChartBase extends React.Component<UsageChartProps, State> {
6969

7070
public componentDidMount() {
7171
this.initDatum();
72-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
72+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7373
}
7474

7575
public componentDidUpdate(prevProps: UsageChartProps) {
@@ -262,7 +262,7 @@ class UsageChartBase extends React.Component<UsageChartProps, State> {
262262

263263
private handleResize = () => {
264264
const { width } = this.state;
265-
const { clientWidth = 0 } = this.containerRef.current || {};
265+
const { clientWidth = 0 } = this.containerRef?.current || {};
266266

267267
if (clientWidth !== width) {
268268
this.setState({ width: clientWidth });

src/routes/details/components/pvcChart/pvcChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class PvcChartBase extends React.Component<PvcChartProps, PvcChartState> {
9292
};
9393

9494
public componentDidMount() {
95-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
95+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
9696
this.updateReport();
9797
}
9898

@@ -111,7 +111,7 @@ class PvcChartBase extends React.Component<PvcChartProps, PvcChartState> {
111111

112112
private handleResize = () => {
113113
const { width } = this.state;
114-
const { clientWidth = 0 } = this.containerRef.current || {};
114+
const { clientWidth = 0 } = this.containerRef?.current || {};
115115

116116
if (clientWidth !== width) {
117117
this.setState({ width: clientWidth });

src/routes/details/components/usageChart/usageChart.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class UsageChartBase extends React.Component<UsageChartProps, UsageChartState> {
6767
};
6868

6969
public componentDidMount() {
70-
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
70+
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
7171
this.updateReport();
7272
}
7373

@@ -86,7 +86,7 @@ class UsageChartBase extends React.Component<UsageChartProps, UsageChartState> {
8686

8787
private handleResize = () => {
8888
const { width } = this.state;
89-
const { clientWidth = 0 } = this.containerRef.current || {};
89+
const { clientWidth = 0 } = this.containerRef?.current || {};
9090

9191
if (clientWidth !== width) {
9292
this.setState({ width: clientWidth });

src/utils/chrome.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const withChrome = Component => {
3232

3333
useLayoutEffect(() => {
3434
isOrgAdmin(auth).then(val => {
35-
if (isMounted.current) {
35+
if (isMounted?.current) {
3636
setOrgAdmin(val);
3737
setInitialized(true);
3838
}

src/utils/hooks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const useStateCallback = <T>(initialState: T): [T, (state: T, cb?: (_stat
3030
useEffect(() => {
3131
// cb.current is `undefined` on initial render,
3232
// so we only invoke callback on state *updates*
33-
if (cbRef.current) {
33+
if (cbRef?.current) {
3434
cbRef.current(state);
3535
cbRef.current = undefined; // reset callback after execution
3636
}

0 commit comments

Comments
 (0)