albusshirazi commented on code in PR #8922:
URL: https://github.com/apache/devlake/pull/8922#discussion_r3407960944


##########
config-ui/src/plugins/components/scope-config-select/index.tsx:
##########
@@ -37,13 +37,14 @@ export const ScopeConfigSelect = ({ plugin, connectionId, 
scopeConfigId, onCance
   const [version, setVersion] = useState(1);
   const [trId, setTrId] = useState<ID>();
   const [open, setOpen] = useState(false);
+  const [showAll, setShowAll] = useState(false);
+  
+  const { ready, data } = useRefreshData(() => showAll ? 
API.scopeConfig.listAll(plugin) : API.scopeConfig.list(plugin, 
connectionId),[version, showAll],);
 
-  const { ready, data } = useRefreshData(() => API.scopeConfig.list(plugin, 
connectionId), [version]);
-
-  const dataSource = useMemo(
-    () => (data ? (scopeConfigId ? [{ id: 'None', name: 'No Scope Config' 
}].concat(data) : data) : []),
-    [data, scopeConfigId],
-  );
+  const dataSource = useMemo(() => {
+  const filtered = showAll ? data : data;

Review Comment:
   The ternary operator evaluates to `data` in both the `true` and `false` 
cases. This means `showAll` has no actual effect, and `filtered` will always 
just be `data`.
   Did you forget to add the filtering logic here? If `showAll` is false, it 
should probably return a filtered subset of `data` rather than the whole array. 
If no filtering is intended yet, you can remove this ternary and the `showAll` 
dependency to keep it clean.



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