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

Frontend refactoring pt.1 #373

Merged
merged 2 commits into from
Sep 18, 2024
Merged

Frontend refactoring pt.1 #373

merged 2 commits into from
Sep 18, 2024

Conversation

corypride
Copy link
Contributor

@corypride corypride commented Sep 12, 2024

Description of the change

Refactor of the any types in the frontend directory

Closes: #369

Screenshot(s)

N/A

Additional context

N/A

frontend/src/api/api.ts Outdated Show resolved Hide resolved
return (
<tr
className="flex flex-row justify-between body-small items-center"
key={Math.random()}
Copy link
Member

Choose a reason for hiding this comment

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

I should have included this in the ticket, but we also need to remove all the instances of Math.random() when used as keys. This changes on each render and causes huge perf issues. Try to use the id field of whatever the item is, and if it doesn't exist, it likely has one that just wasn't added to the interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do that in most cases, but this enum that is used in MyCourses does not have an id...
image

Copy link
Member

Choose a reason for hiding this comment

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

It would be the Outcome (certificate) that would need the ID in this particular instance.

but if there is one where you cannot use an ID, then use the index of the array you are calling map on

frontend/src/Components/forms/LoginForm.tsx Show resolved Hide resolved
frontend/src/Components/UserActivityMap.tsx Outdated Show resolved Hide resolved
frontend/src/Components/MilestonesBarChart.tsx Outdated Show resolved Hide resolved
@PThorpe92 PThorpe92 merged commit 6a229c7 into refactor_branch Sep 18, 2024
@PThorpe92 PThorpe92 deleted the any_refactor branch September 18, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants