Implement dynamic SMTP setting loader, admin product dependency matrix UI, recursive deselect cascade, and backend catalog validation
All checks were successful
Staging Build / build (push) Successful in 2m19s
All checks were successful
Staging Build / build (push) Successful in 2m19s
This commit is contained in:
@@ -48,12 +48,18 @@ function toggleModuleInList(
|
||||
): string[] {
|
||||
const isSelected = currentIds.includes(toggleId)
|
||||
if (isSelected) {
|
||||
const next = currentIds.filter(id => id !== toggleId)
|
||||
// cascade: remove modules that required this one
|
||||
return next.filter(mId => {
|
||||
const m = modules.find(mod => mod.id === mId)
|
||||
return !m?.requirements || m.requirements.every(reqId => next.includes(reqId) || reqId === toggleId)
|
||||
}).filter(id => id !== toggleId)
|
||||
// Recursive removal: repeatedly filter until no more dependent modules are removed
|
||||
let next = currentIds.filter(id => id !== toggleId)
|
||||
let changed = true
|
||||
while (changed) {
|
||||
const beforeLength = next.length
|
||||
next = next.filter(mId => {
|
||||
const m = modules.find(mod => mod.id === mId)
|
||||
return !m?.requirements || m.requirements.every(reqId => next.includes(reqId))
|
||||
})
|
||||
changed = next.length !== beforeLength
|
||||
}
|
||||
return next
|
||||
} else {
|
||||
const module = modules.find(m => m.id === toggleId)
|
||||
if (module?.exclusions?.some(exId => currentIds.includes(exId))) return currentIds
|
||||
|
||||
Reference in New Issue
Block a user