korbit-ai[bot] commented on code in PR #32870:
URL: https://github.com/apache/superset/pull/32870#discussion_r2014936174
##########
superset-frontend/src/dashboard/components/DashboardBuilder/state.ts:
##########
@@ -68,8 +69,11 @@ export const useNativeFilters = () => {
useEffect(() => {
if (
- expandFilters === false ||
- (filterValues.length === 0 && nativeFiltersEnabled)
+ isFeatureEnabled(FeatureFlag.FilterBarClosedByDefault) &&
+ expandFilters === null
+ ? true
+ : expandFilters === false ||
+ (filterValues.length === 0 && nativeFiltersEnabled)
) {
Review Comment:
### Incorrect Filter Panel Default State Logic <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The conditional logic has incorrect operator precedence and confusing
ternary usage that doesn't match the intended functionality of hiding the
filter panel by default.
###### Why this matters
The current logic will cause the filter panel to remain open in scenarios
where it should be closed, not fulfilling the requirement of having filters
closed by default when the feature flag is enabled.
###### Suggested change ∙ *Feature Preview*
Restructure the condition to properly handle the feature flag and
expandFilters cases:
```typescript
if (
(isFeatureEnabled(FeatureFlag.FilterBarClosedByDefault) && expandFilters
=== null) ||
expandFilters === false ||
(filterValues.length === 0 && nativeFiltersEnabled)
)
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d90e19bd-7755-44e9-81e7-d92e1daecd69/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d90e19bd-7755-44e9-81e7-d92e1daecd69?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d90e19bd-7755-44e9-81e7-d92e1daecd69?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d90e19bd-7755-44e9-81e7-d92e1daecd69?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d90e19bd-7755-44e9-81e7-d92e1daecd69)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:91d35a5c-5ea6-4265-8cdc-1fe03f12fe1e -->
[](91d35a5c-5ea6-4265-8cdc-1fe03f12fe1e)
--
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]