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

Handle the case if there is no data of selector ID argument #103

Open
dzintars opened this issue Aug 1, 2020 · 1 comment
Open

Handle the case if there is no data of selector ID argument #103

dzintars opened this issue Aug 1, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@dzintars
Copy link
Owner

dzintars commented Aug 1, 2020

If there is no modules of the given app ID, there is an error.

return allIds.map(id => state.entities[id]) // Returns an array!!!

@dzintars dzintars added the bug Something isn't working label Aug 1, 2020
@dzintars dzintars self-assigned this Aug 1, 2020
@dzintars
Copy link
Owner Author

export const getCurrentUser = createSelector(
    getCurrentUserId,
    (state) => state.entities.users.profiles,
    (currentUserId, profiles) => {
        if (!profiles.hasOwnProperty(currentUserId)) {
            // Current user not found
            return {};
        }

        return profiles[currentUserId];
    }
);

https://developers.mattermost.com/contribute/redux/selectors/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant