Skip to content

Commit

Permalink
ui: prevent statement/transaction page from sending infinite API
Browse files Browse the repository at this point in the history
requests when the API requests fails

Previously, Statement Page and Transaction Page issues API requests
in conmponentDidUpdate() React lifecycle hook. However, when the
backend API returns an error, this lifecycle hook is constantly
triggered which resulted in infinite loop. This crashes the entire
frontend application.
This commit removes API calls from within the componentDidUpdate()
hooks.

Resolves cockroachdb#68602

Release note: None
  • Loading branch information
Azhng committed Sep 30, 2021
1 parent 150d5b7 commit 6b1ca52
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ export class StatementsPage extends React.Component<
if (this.state.search && this.state.search !== prevState.search) {
this.props.onSearchComplete(this.filteredStatementsData());
}
this.refreshStatements();
if (!this.props.isTenant) {
this.props.refreshStatementDiagnosticsRequests();
}
};

componentWillUnmount(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Action } from "redux";
* Extended version of default `redux-saga/effects/throttle` effect implementation
* with ability to provide actions that trigger reset on delay timer.
*
* For example, `initRequest` sata has to be throttled by specified amount of time and
* For example, `initRequest` saga has to be throttled by specified amount of time and
* also `initRequest` call when specific action dispatched (even if timeout doesn't
* occur).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ export class TransactionsPage extends React.Component<
componentDidMount(): void {
this.refreshData();
}
componentDidUpdate(): void {
this.refreshData();
}

syncHistory = (params: Record<string, string | undefined>) => {
const { history } = this.props;
Expand Down

0 comments on commit 6b1ca52

Please sign in to comment.