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

Possible oversight when rendering Swiss matches. #817

Open
robigan opened this issue Jul 14, 2024 · 2 comments
Open

Possible oversight when rendering Swiss matches. #817

robigan opened this issue Jul 14, 2024 · 2 comments
Labels

Comments

@robigan
Copy link
Contributor

robigan commented Jul 14, 2024

The page to view Swiss matches might include a slight oversight wherein it seems to assume that stageItem will always succeed. I see that there is an if check on

if (responseIsValid(swrStagesResponse) && stageItemId != null) {
before fetching additional data but the latter half of the if check is useless as Next will always assure a non-nullable value, and it doesn't actually check that the data exists in the DB to begin with. When a page is requested with an ID that doesn't exist in
if (responseIsValid(swrStagesResponse) && stageItemId != null) {
stageItem = getStageItemLookup(swrStagesResponse)[stageItemId];
[activeStage] = getStageById(swrStagesResponse, stageItem.stage_id);
if (activeStage != null && activeStage.stage_items != null) {
it attempts to query further data, but it fails causing an error to be bubbled up. I would propose moving up the if check, removing the latter half of the check, making the variables defined use the useState hook rather than define them using let and implementing another if check to validate that the correct data is queried.

Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. What is the action to take here?

@github-actions github-actions bot added the Stale label Sep 13, 2024
@evroon evroon removed the Stale label Sep 13, 2024
Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. What is the action to take here?

@github-actions github-actions bot added the Stale label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants