pierrejeambrun commented on code in PR #64271:
URL: https://github.com/apache/airflow/pull/64271#discussion_r3116552105


##########
airflow-core/src/airflow/ui/src/context/groups/GroupsProvider.tsx:
##########
@@ -57,21 +54,17 @@ export const OpenGroupsProvider = ({ children, dagId }: 
Props) => {
     { enabled: Boolean(dagId) && selectedVersion !== undefined },
   );
 
-  // Update allGroupIds whenever structure changes
-  useEffect(() => {
-    const observedGroupIds = flattenGraphNodes(structure.nodes).allGroupIds;
+  const { allGroupIds: observedGroupIds, allOperators } = 
flattenGraphNodes(structure.nodes);
 
+  useEffect(() => {
     if (JSON.stringify(observedGroupIds) !== 
JSON.stringify(allGroupIdsRef.current)) {

Review Comment:
   Double `JSON.stringify` on every render is pretty expensive for big DAGs. 
Use `length` + `every()` element comparison, or compute `observedGroupIds` 
outside the effect and use its reference as the dep.



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