From 619297202bbcc0c07e5a60a0f9c2804080bbc621 Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Wed, 26 Jun 2019 15:13:28 -0400 Subject: [PATCH] Adds optional chaining. (#869) --- babel.config.js | 1 + package-lock.json | 21 ++++++++++++++++++++- package.json | 1 + src/selectors/entities/groups.js | 4 ++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/babel.config.js b/babel.config.js index a132349f2..aaea5532f 100644 --- a/babel.config.js +++ b/babel.config.js @@ -18,6 +18,7 @@ module.exports = { plugins: [ '@babel/transform-flow-comments', '@babel/proposal-class-properties', + '@babel/plugin-proposal-optional-chaining', ['module-resolver', { root: ['./src', '.'], }], diff --git a/package-lock.json b/package-lock.json index b4d2b5c9b..2980c17d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -451,6 +451,16 @@ "@babel/plugin-syntax-optional-catch-binding": "^7.2.0" } }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.2.0.tgz", + "integrity": "sha512-ea3Q6edZC/55wEBVZAEz42v528VulyO0eir+7uky/sT4XRcdkWJcFi1aPtitTlwUzGnECWJNExWww1SStt+yWw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-optional-chaining": "^7.2.0" + } + }, "@babel/plugin-proposal-unicode-property-regex": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz", @@ -507,6 +517,15 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.2.0.tgz", + "integrity": "sha512-HtGCtvp5Uq/jH/WNUPkK6b7rufnCPLLlDAFN7cmACoIjaOOiXxUt3SswU5loHqrhtqTsa/WoLQ1OQ1AGuZqaWA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, "@babel/plugin-transform-arrow-functions": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz", @@ -9844,7 +9863,7 @@ }, "serialize-error": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz", "integrity": "sha1-ULZ51WNc34Rme9yOWa9OW4HV9go=" }, "serialize-javascript": { diff --git a/package.json b/package.json index 18048c9ca..749e15969 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@babel/cli": "7.4.4", "@babel/core": "7.4.5", "@babel/plugin-proposal-class-properties": "7.4.4", + "@babel/plugin-proposal-optional-chaining": "^7.2.0", "@babel/plugin-transform-flow-comments": "7.4.4", "@babel/preset-env": "7.2.0", "@babel/register": "7.4.4", diff --git a/src/selectors/entities/groups.js b/src/selectors/entities/groups.js index 15c721763..50d432137 100644 --- a/src/selectors/entities/groups.js +++ b/src/selectors/entities/groups.js @@ -46,9 +46,9 @@ export function getGroupMembers(state, id) { return groupMemberData.members; } -const teamGroupIDs = (state, teamID) => state.entities.teams.groupsAssociatedToTeam[teamID].ids || []; +const teamGroupIDs = (state, teamID) => state.entities.teams.groupsAssociatedToTeam[teamID]?.ids || []; -const channelGroupIDs = (state, channelID) => state.entities.channels.groupsAssociatedToChannel[channelID].ids || []; +const channelGroupIDs = (state, channelID) => state.entities.channels.groupsAssociatedToChannel[channelID]?.ids || []; const getTeamGroupIDSet = createSelector( teamGroupIDs,