-
Notifications
You must be signed in to change notification settings - Fork 16.7k
fix(native-filters): prevent circular dependencies and improve dependency handling #35317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
108dd3d
ca6fbba
0b848dc
32ba5c1
24518d9
a7d8e76
d99f34f
df025e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -584,7 +584,10 @@ const FiltersConfigForm = ( | |
| return Promise.reject(new Error(t('Pre-filter is required'))); | ||
| }; | ||
|
|
||
| const availableFilters = getAvailableFilters(filterId); | ||
| const availableFilters = useMemo( | ||
| () => getAvailableFilters(filterId), | ||
| [getAvailableFilters, filterId, filters], | ||
| ); | ||
|
Comment on lines
+587
to
+590
This comment was marked as resolved.
Sorry, something went wrong.
Comment on lines
+587
to
+590
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Memoization dependency mismatch with function parameters
Tell me moreWhat is the issue?The useMemo dependency array includes Why this mattersThis could lead to unnecessary re-computations when Suggested change ∙ Feature PreviewVerify that const availableFilters = useMemo(
() => getAvailableFilters(filterId, filters),
[getAvailableFilters, filterId, filters],
);Or if const availableFilters = useMemo(
() => getAvailableFilters(filterId),
[getAvailableFilters, filterId],
);Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit.
msyavuz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const hasAvailableFilters = availableFilters.length > 0; | ||
| const hasTimeDependency = availableFilters | ||
| .filter(filter => filter.type === 'filter_time') | ||
|
|
@@ -918,7 +921,8 @@ const FiltersConfigForm = ( | |
| children: ( | ||
| <> | ||
| {canDependOnOtherFilters && | ||
| hasAvailableFilters && ( | ||
| (hasAvailableFilters || | ||
| dependencies.length > 0) && ( | ||
|
Comment on lines
920
to
+925
This comment was marked as resolved.
Sorry, something went wrong. |
||
| <StyledRowFormItem | ||
| expanded={expanded} | ||
| name={[ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.