Copilot commented on code in PR #4800:
URL: https://github.com/apache/solr/pull/4800#discussion_r3838906381


##########
solr/webapp/web/js/angular/controllers/security.js:
##########
@@ -777,10 +828,11 @@ solrAdminApp.controller('SecurityController', function 
($scope, $timeout, $cooki
             return;
           }
           $scope.togglePermDialog();
-          // avoids a weird race with not getting the latest config after an 
update
-          Security.get({path: "authorization"}, function (ignore) {
-            $scope.refreshSecurityPanel();
-          });
+          whenReflected("authorization", function (data2) {
+            var have = permissionRoles(data2, setPermJson.name);
+            var want = asList(setPermJson.role);
+            return have != null && have.length === want.length && want.every(r 
=> have.includes(r));
+          }, $scope.refreshSecurityPanel);

Review Comment:
   `whenReflected(...)` is used for the index-reposition path, but the common 
add/update-permission path (later in this same function) still uses the older 
`Security.get(...); refreshSecurityPanel();` hack. That means the stale-refresh 
race this PR addresses can still occur for permission add/update, and it also 
contradicts the PR description (“applied to all write paths”). Consider 
switching the non-`indexUpdated` branch to use `whenReflected("authorization", 
...)` with the same `permissionRoles`/role list check so all permission writes 
wait deterministically for the config to be visible before refreshing.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to