drodil / backstage-plugin-qeta

Backstage.io plugin for Q&A
https://www.npmjs.com/package/@drodil/backstage-plugin-qeta
MIT License
81 stars 25 forks source link

fix: add user prefix to entityRef in UserLink #153

Closed Revyy closed 4 months ago

Revyy commented 4 months ago

Possible fix for issue: https://github.com/drodil/backstage-plugin-qeta/issues/152.

The if-statement in UserLink won't be executed at the moment if the entityRef is actually 'anonymous' as it will then always crash when executing useEntityPresentation.

A possible fix could be to move the check to the AuthorLink component as this PR suggests. Not sure if it would need to be added in more places, like UpdatedByLink for example.

drodil commented 4 months ago

Hm.. How about if you add check for the entityRef before using the hook that it starts with user: and add the prefix if it doesn't?

drodil commented 4 months ago

Great, thanks a lot, will release a fix version!