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

fix SelectUser component when there is no deskId #4657

Merged

Conversation

petrjasek
Copy link
Member

SDESK-7411

@petrjasek petrjasek requested a review from tomaskikutis October 8, 2024 16:35
@petrjasek petrjasek added this to the 2.8.1 milestone Oct 8, 2024
export const user = {
hasPrivilege,
isLoggedIn,
getCurrentUserId,
getAll,
Copy link
Member

Choose a reason for hiding this comment

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

Can you export an OrderedMap<IUser['_id'], IUser]> from the API? So we also have a capability to get a user by ID without having to iterate.

Copy link
Member

Choose a reason for hiding this comment

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

It works quite well with vocabularies which I did a while ago https://github.com/superdesk/superdesk-client-core/blob/develop/scripts/api/vocabularies.ts#L97

When thinking more about it, I'm not sure whether it's better to expose an ordered map or simply have 2 methods - getAll that would return an array and getById that would return a single item - without involving immutable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it makes sense to get the map, imo when you get all users it's usually rather for a lookup and not for listing them, this is rather an edge case.

Copy link
Member

Choose a reason for hiding this comment

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

Functionally it works great both - lookup and iteration. The only thing I'm wary about is developers being confused that getting all items when they only need one would be expensive in terms of performance when in reality it wouldn't.

@petrjasek petrjasek requested a review from tomaskikutis October 9, 2024 08:38
@petrjasek petrjasek merged commit a19b3e1 into superdesk:release/2.8 Oct 9, 2024
3 checks passed
@petrjasek petrjasek deleted the fix-select-user-without-desk branch October 9, 2024 09:25
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