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

Cleaning comments, unused values and eslint ignores #94

Merged
merged 3 commits into from
May 1, 2024

Conversation

h0ethan04
Copy link
Contributor

closes #92

Co-authored-by: ThatMegamind <[email protected]>
Co-authored-by: michellelin1 <[email protected]>
@h0ethan04 h0ethan04 self-assigned this May 1, 2024
Comment on lines +36 to +53
const renderSeasons = async () => {
const { data } = await NPOBackend.get('/published-schedule/all-seasons');
if (data.indexOf(curSeason) == -1) {
data.unshift(curSeason);
}

if (selectedSeason === '') {
setSelectedSeason(curSeason);
const seasonOrder = ['Fall', 'Summer', 'Spring'];
data.sort((a, b) => {
// Compare years first
if (a.split(' ')[1] !== b.split(' ')[1]) {
return b.split(' ')[1] - a.split(' ')[1];
} else {
return seasonOrder.indexOf(a.split(' ')[0]) - seasonOrder.indexOf(b.split(' ')[0]);
}
});

const seasonOrder = ['Fall', 'Summer', 'Spring'];
data.sort((a, b) => {
// Compare years first
if (a.split(' ')[1] !== b.split(' ')[1]) {
return b.split(' ')[1] - a.split(' ')[1];
} else {
return seasonOrder.indexOf(a.split(' ')[0]) - seasonOrder.indexOf(b.split(' ')[0]);
}
});
setAllSeasons(data);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] <react-hooks/exhaustive-deps> reported by reviewdog 🐶
The 'renderSeasons' function makes the dependencies of useEffect Hook (at line 67) change on every render. To fix this, wrap the definition of 'renderSeasons' in its own useCallback() Hook.

setSelectedSeason(curSeason);
}
renderSeasons();
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] <react-hooks/exhaustive-deps> reported by reviewdog 🐶
React Hook useEffect has missing dependencies: 'curSeason', 'renderSeasons', and 'selectedSeason'. Either include them or remove the dependency array.

@ThatMegamind ThatMegamind merged commit a648ffb into dev May 1, 2024
4 checks passed
@ThatMegamind ThatMegamind deleted the 92-cleaning-consolelogs-in-frontend branch May 1, 2024 19:37
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.

4 participants