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

Calypso undefined protection #68

Merged
merged 2 commits into from
Apr 2, 2024
Merged

Conversation

Herkarl
Copy link
Member

@Herkarl Herkarl commented Apr 2, 2024

Apparently Calypso doesn't return json for some malformed queries.

(eg. https://calypso.datasektionen.se/api/item/[)
This adds undefined protection for one of the places that uses the Calypso component.
This is the only instance of the Calypso component that fetches a direct item, all other ones fetches a list of items with some kind of filter applied, and should not be affected by this particular error.

I started refactoring the component a bit, but decided to not do too much. Getting an itch from it, so might do a larger refactor at some point.

@Herkarl Herkarl requested a review from foodelevator April 2, 2024 21:47
Copy link
Member

@foodelevator foodelevator left a comment

Choose a reason for hiding this comment

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

Nice! Seems to work!

</header>
<Translate>
<English>{`${item ? item.titleEnglish : "????"} - Konglig Datasektionen`}</English>
<Swedish>{`${item ? item.titleSwedish : "????"} - Konglig Datasektionen`}</Swedish>
Copy link
Member

Choose a reason for hiding this comment

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

????

Copy link
Member Author

Choose a reason for hiding this comment

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

!!!!!

Copy link
Member Author

@Herkarl Herkarl Apr 2, 2024

Choose a reason for hiding this comment

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

(it is an edgecase, and only appears in the browser titlebar, so I thought it was kinda funny to keep it that way)

@Herkarl Herkarl merged commit 173093c into master Apr 2, 2024
1 check passed
@Herkarl Herkarl deleted the calypso-undefined-protection branch April 2, 2024 21:59
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