Simplify code using `filter`/`map`
This makes it more obvious what is going on at a glance. Refactoring the code in this way revealed to TS a hazard where `newGroupId` could, at least based only on local reasoning, be null. In practice this shouldn't happen due to the contexts when the method is called, but I've added a check to be safe and keep TS happy.
Showing
Please register or sign in to comment