dzintars / front

Test setup (Don't use!) Dev server URL available while i'm developing.
https://front.oswee.dev
1 stars 1 forks source link

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

Open dzintars opened 4 years ago

dzintars commented 4 years ago

If there is no modules of the given app ID, there is an error. https://github.com/dzintars/front/blob/13e9e98241e65e27f5a4a27aaaf022e183d49de1/src/store/features/app-navigation/selectors.ts#L19

dzintars commented 4 years ago
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/