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

bug: Viewing anonymous questions/answers causes crash on frontend #152

Open
Revyy opened this issue Apr 24, 2024 · 2 comments
Open

bug: Viewing anonymous questions/answers causes crash on frontend #152

Revyy opened this issue Apr 24, 2024 · 2 comments

Comments

@Revyy
Copy link
Contributor

Revyy commented Apr 24, 2024

Anonymous questions and answers causes an error in Backstage if the person viewing the question is not the author of the question.

The culprit seems to be this line const { primaryTitle: userName } = useEntityPresentation(entityRef); in UserLink

useEntityPresentation expects a valid entity reference I suppose and since the anonymous check is executed after then it gets passed the string 'anonymous' and crashes.

Moving the if (entityRef === 'anonymous') above useEntityPresentation works but the linter will complain about that since useEntityPresentation is a react hook.

Image of error:

Screenshot 2024-04-24 at 13 57 51

I can create a PR with a possible fix.

@drodil
Copy link
Owner

drodil commented Apr 24, 2024

Thanks for the report! If you can come up with a PR, it would be much appreciated!

@drodil
Copy link
Owner

drodil commented Apr 24, 2024

@Revyy can you verify the fix in the new release so we can close this? Thanks!

drodil added a commit that referenced this issue May 6, 2024
…lect

fix: Fixed issue #152, entity filter disappear on select and selected entity showing twice in dropdown
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

No branches or pull requests

2 participants