mcgilman commented on code in PR #10910:
URL: https://github.com/apache/nifi/pull/10910#discussion_r2920260665


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/users/state/user-listing/user-listing.effects.ts:
##########
@@ -622,7 +639,7 @@ export class UserListingEffects {
         this.actions$.pipe(
             ofType(UserListingActions.updateUserGroup),
             map((action) => action.request),
-            switchMap((request) =>
+            mergeMap((request) =>

Review Comment:
   The switchMap → mergeMap change in updateUserGroup$ correctly addresses the 
root cause. Thanks for catching this.



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/users/state/user-listing/user-listing.effects.ts:
##########
@@ -263,17 +263,23 @@ export class UserListingEffects {
             ofType(UserListingActions.createUserSuccess),
             map((action) => action.response),
             filter((response) => response.userGroupUpdate != null),
-            mergeMap((createUserResponse) =>
-                this.actions$.pipe(
+            mergeMap((createUserResponse) => {
+                // @ts-ignore
+                const expectedCount = 
createUserResponse.userGroupUpdate.userGroups?.length || 0;

Review Comment:
   You can avoid the @ts-ignore here by extending the optional chaining one 
level up — this lets the compiler handle the nullability without suppressing 
other potential errors:
   
   `const expectedCount = 
createUserResponse.userGroupUpdate?.userGroups?.length ?? 0;`



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/users/state/user-listing/user-listing.effects.ts:
##########
@@ -539,17 +545,28 @@ export class UserListingEffects {
             ofType(UserListingActions.updateUserSuccess),
             map((action) => action.response),
             filter((response) => response.userGroupUpdate != null),
-            mergeMap((updateUserResponse) =>
-                this.actions$.pipe(
+            mergeMap((updateUserResponse) => {
+                // @ts-ignore
+                const addedCount = 
updateUserResponse.userGroupUpdate.userGroupsAdded?.length || 0;
+                // @ts-ignore
+                const removedCount = 
updateUserResponse.userGroupUpdate.userGroupsRemoved?.length || 0;

Review Comment:
   Same pattern here:
   
   ```
   const addedCount = 
updateUserResponse.userGroupUpdate?.userGroupsAdded?.length ?? 0;
   const removedCount = 
updateUserResponse.userGroupUpdate?.userGroupsRemoved?.length ?? 0;
   ```



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/users/state/user-listing/user-listing.effects.ts:
##########
@@ -525,7 +531,7 @@ export class UserListingEffects {
                     if (userGroupUpdates.length === 0) {
                         return of(UserListingActions.updateUserComplete());
                     } else {
-                        return userGroupUpdates;
+                        return from(userGroupUpdates);

Review Comment:
   Good change wrapping in from() here. It makes the intent clearer. Would you 
mind doing the same in createUserSuccess$ (line 234)? It still returns the raw 
array there. Both work, but it'd be nice to keep them consistent.
   
   `return userGroupUpdates;`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to