Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current prop #4041

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/routes/components/charts/costChart/costChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CostChartBase extends React.Component<CostChartProps, State> {

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CostExplorerChartBase extends React.Component<CostExplorerChartProps, Stat

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class DailyCostChartBase extends React.Component<DailyCostChartProps, State> {

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class DailyTrendChartBase extends React.Component<DailyTrendChartProps, State> {

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class HistoricalCostChartBase extends React.Component<HistoricalCostChartProps,

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class HistoricalTrendChartBase extends React.Component<HistoricalTrendChartProps

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class HistoricalUsageChartBase extends React.Component<HistoricalUsageChartProps

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
4 changes: 2 additions & 2 deletions src/routes/components/charts/trendChart/trendChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class TrendChartBase extends React.Component<TrendChartProps, State> {

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
4 changes: 2 additions & 2 deletions src/routes/components/charts/usageChart/usageChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class UsageChartBase extends React.Component<UsageChartProps, State> {

public componentDidMount() {
this.initDatum();
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
4 changes: 2 additions & 2 deletions src/routes/details/components/pvcChart/pvcChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class PvcChartBase extends React.Component<PvcChartProps, PvcChartState> {
};

public componentDidMount() {
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
this.updateReport();
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
4 changes: 2 additions & 2 deletions src/routes/details/components/usageChart/usageChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class UsageChartBase extends React.Component<UsageChartProps, UsageChartState> {
};

public componentDidMount() {
this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
this.observer = getResizeObserver(this.containerRef?.current, this.handleResize);
this.updateReport();
}

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

private handleResize = () => {
const { width } = this.state;
const { clientWidth = 0 } = this.containerRef.current || {};
const { clientWidth = 0 } = this.containerRef?.current || {};

if (clientWidth !== width) {
this.setState({ width: clientWidth });
Expand Down
2 changes: 1 addition & 1 deletion src/utils/chrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const withChrome = Component => {

useLayoutEffect(() => {
isOrgAdmin(auth).then(val => {
if (isMounted.current) {
if (isMounted?.current) {
setOrgAdmin(val);
setInitialized(true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const useStateCallback = <T>(initialState: T): [T, (state: T, cb?: (_stat
useEffect(() => {
// cb.current is `undefined` on initial render,
// so we only invoke callback on state *updates*
if (cbRef.current) {
if (cbRef?.current) {
cbRef.current(state);
cbRef.current = undefined; // reset callback after execution
}
Expand Down
Loading