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

BB-707: Don't create CBReviewModal for deleted entities #942

Merged
merged 1 commit into from
Feb 28, 2023
Merged

Conversation

MonkeyDo
Copy link
Contributor

@MonkeyDo MonkeyDo commented Feb 28, 2023

We can't load a deleted entity page, the website just times out and returns a 504.

Looking at the logs, we see:

Unhandled rejection TypeError: Cannot read properties of undefined (reading 'name')
    at WorkDisplayPage (/home/bookbrainz/bookbrainz-site/lib/client/components/pages/entities/work.js:143:37)

Looking at the WorkDisplayPage component, the issue is pretty clear: we are trying to pass entity.defaultAlias.name as a prop to the CBReviewModal, but on a deleted entity defaultAlias will be undefined, resulting in the error above.
The same goes for the other reviewable entities.

Solution: wrap the modal in the same condition we use elsewhere in the same pages: {!entity.deleted && <CBReviewModal …

There might be another issue described in the ticket, but at least the 504 issue is solved in this PR.

@MonkeyDo MonkeyDo merged commit db31f89 into master Feb 28, 2023
@MonkeyDo MonkeyDo deleted the BB-707 branch February 28, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant