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

fix: Fix rows counter in the Edit Grade modal window #389

Open
wants to merge 1 commit into
base: open-release/quince.master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ exports[`OverrideTable component render snapshot 1`] = `
},
]
}
itemCount={2}
itemCount={3}
/>
`;
20 changes: 11 additions & 9 deletions src/components/GradesView/EditModal/OverrideTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ export const OverrideTable = () => {

if (hide) { return null; }

const tableData = [
...data,
{
adjustedGrade: <AdjustedGradeInput />,
date: formatDateForDisplay(new Date()),
reason: <ReasonInput />,
},
];
Comment on lines +23 to +30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put a check on the data something like

Suggested change
const tableData = [
...data,
{
adjustedGrade: <AdjustedGradeInput />,
date: formatDateForDisplay(new Date()),
reason: <ReasonInput />,
},
];
const tableData = data ? [
...data,
{
adjustedGrade: <AdjustedGradeInput />,
date: formatDateForDisplay(new Date()),
reason: <ReasonInput />,
},
] : [];

While testing I landed up on error when data was undefined and this happened multiple times mostly I guess when the states were getting updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peek 2024-08-02 01-09

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should backport 4e9270a


return (
<DataTable
columns={columns}
data={[
...data,
{
adjustedGrade: <AdjustedGradeInput />,
date: formatDateForDisplay(new Date()),
reason: <ReasonInput />,
},
]}
itemCount={data.length}
data={tableData}
itemCount={tableData.length}
/>
);
};
Expand Down
Loading