Skip to content

Commit

Permalink
using DidMount instead of DidUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Dec 9, 2020
1 parent b89ea58 commit cf99cd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cvat-ui/src/components/projects-page/project-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ProjectListComponent(): JSX.Element {
<Col className='cvat-projects-list' md={22} lg={18} xl={16} xxl={14}>
{projectInstances.map(
(row: any[]): JSX.Element => (
<Row gutter={[8, 8]}>
<Row key={row[0].id} gutter={[8, 8]}>
{row.map((instance: any) => (
<Col span={6} key={instance.id}>
<ProjectItem projectInstance={instance} />
Expand Down
10 changes: 6 additions & 4 deletions cvat-ui/src/components/task-page/task-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ interface TaskPageComponentProps {
type Props = TaskPageComponentProps & RouteComponentProps<{ id: string }>;

class TaskPageComponent extends React.PureComponent<Props> {
public componentDidUpdate(): void {
const {
deleteActivity, history, task, fetching, getTask,
} = this.props;
public componentDidMount(): void {
const { task, fetching, getTask } = this.props;

if (task === null && !fetching) {
getTask();
}
}

public componentDidUpdate(): void {
const { deleteActivity, history } = this.props;

if (deleteActivity) {
history.replace('/tasks');
Expand Down

0 comments on commit cf99cd6

Please sign in to comment.