saiaika opened a new pull request, #33960: URL: https://github.com/apache/superset/pull/33960
## Description Fixes #33908 - Prevents users from creating bi-directional (cyclic) dependencies between dashboard filters, including indirect cycles that could be created after saving initial configurations. ## Problem The existing validation only checked for cyclic dependencies during immediate UI interactions, but users could still create indirect cycles by: 1. Setting up Filter A → depends on Filter B 2. Saving the configuration 3. Later editing Filter B → to depend on Filter A 4. Saving again (this would create a cycle but wasn't blocked) ## Solution - Added comprehensive validation in the `handleSave` method of `FiltersConfigModal.tsx` - The validation now runs before every save operation and blocks saving if any cyclic dependency is detected - Added proper error handling with user feedback when cycles are found - Ensures all filter types are protected from creating bidirectional dependencies ## Changes Made - **FiltersConfigModal.tsx**: Added `validateDependencies()` call in `handleSave` method with error checking - **FiltersConfigModal.test.tsx**: Added comprehensive tests covering both immediate and indirect cyclic dependency scenarios - **ISSUE_33908_FIX_SUMMARY.md**: Detailed documentation of the fix and verification ## Test Coverage - ✅ Test immediate cyclic dependency blocking (existing functionality preserved) - ✅ Test indirect cyclic dependency blocking (main issue fix) - ✅ Test error message display when cycles are detected - ✅ Test successful save when no cycles exist - ✅ Verify focus is set to problematic filter when cycle is found ## Technical Details The fix adds save-time validation by: 1. Calling `validateDependencies()` before saving 2. Checking form fields for dependency validation errors 3. Blocking save operation if cycles are detected 4. Providing user feedback by focusing on the problematic filter ## Verification This fix has been verified to address the exact scenario described in issue #33908: - ✅ Indirect cyclic dependencies are now blocked at save time - ✅ Users receive clear feedback about the cyclic dependency - ✅ The problematic filter is automatically focused for easy correction - ✅ All existing functionality remains intact - ✅ Works for all filter types (select, range, time, etc.) ## Testing Run the following to test the changes: ```bash cd superset-frontend npm test -- FiltersConfigModal.test.tsx -- 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]
