Skip to content

Commit

Permalink
fix: Submitted Data rerendering during submission polling
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Jun 5, 2024
1 parent 00d22cd commit 40996af
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/DataSubmissions/MetadataUpload.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MockedProvider, MockedResponse } from "@apollo/client/testing";
import { axe } from "jest-axe";
import userEvent from "@testing-library/user-event";
import { Context, ContextState, Status as AuthStatus } from "../Contexts/AuthContext";
import { MetadataUpload } from "./MetadataUpload";
import MetadataUpload from "./MetadataUpload";
import { CREATE_BATCH, CreateBatchResp, UPDATE_BATCH } from "../../graphql";

// NOTE: We omit any properties that are explicitly used within component logic
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataSubmissions/MetadataUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Props = {
* @param {Props} props
* @returns {React.FC<Props>}
*/
export const MetadataUpload = ({ submission, readOnly, onCreateBatch, onUpload }: Props) => {
const MetadataUpload = ({ submission, readOnly, onCreateBatch, onUpload }: Props) => {
const { submissionId } = useParams();
const { user } = useAuthContext();

Expand Down
2 changes: 1 addition & 1 deletion src/content/dataSubmissions/DataSubmission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useSnackbar, VariantType } from "notistack";
import bannerPng from "../../assets/dataSubmissions/dashboard_banner.png";
import summaryBannerSvg from "../../assets/dataSubmissions/summary_banner.png";
import LinkTab from "../../components/DataSubmissions/LinkTab";
import { MetadataUpload } from "../../components/DataSubmissions/MetadataUpload";
import MetadataUpload from "../../components/DataSubmissions/MetadataUpload";
import {
GET_SUBMISSION,
LIST_BATCHES,
Expand Down
6 changes: 4 additions & 2 deletions src/content/dataSubmissions/SubmittedData.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useMemo, useRef, useState } from "react";
import React, { FC, useMemo, useRef, useState } from "react";
import { useLazyQuery } from "@apollo/client";
import { isEqual } from "lodash";
import { useSnackbar } from "notistack";
Expand Down Expand Up @@ -161,4 +161,6 @@ const SubmittedData: FC<Props> = ({ submissionId, submissionName }) => {
);
};

export default SubmittedData;
export default React.memo<Props>(SubmittedData, (prevProps, nextProps) =>
isEqual(prevProps, nextProps)
);

0 comments on commit 40996af

Please sign in to comment.