bbovenzi commented on code in PR #67597:
URL: https://github.com/apache/airflow/pull/67597#discussion_r3313574197
##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/PluginImportErrorsModal.tsx:
##########
@@ -81,9 +86,16 @@ export const PluginImportErrorsModal:
React.FC<PluginImportErrorsModalProps> = (
<Dialog.CloseTrigger />
<Dialog.Body>
- <Accordion.Root collapsible multiple size="md" variant="enclosed">
+ <Accordion.Root
+ collapsible
+ multiple
+ onValueChange={(details) => setOpenItems(details.value)}
Review Comment:
We can use `key` and `defaultValue` in order to manage the openIds
##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/PluginImportErrorsModal.tsx:
##########
@@ -63,6 +64,10 @@ export const PluginImportErrorsModal:
React.FC<PluginImportErrorsModalProps> = (
setPage(1);
}, [searchQuery, importErrors]);
+ useEffect(() => {
+ setOpenItems(filteredErrors.slice((page - 1) * PAGE_LIMIT, page *
PAGE_LIMIT).map((err) => err.source));
+ }, [filteredErrors, page]);
+
Review Comment:
Again, we should always try to avoid mixing useState and useEffect
https://react.dev/learn/you-might-not-need-an-effect
And if it really is necessary then we should leave a comment justifying it.
--
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]