OpenConceptLab/ocl_issues#2644 | fix Remove Resources by Reference dialog feedback and radio grouping#40
Open
jamlung-ri wants to merge 1 commit into
Conversation
…alog feedback and radio grouping Fixes two bugs in the "Remove Resources by Reference" dialog reported by MSF: 1. onExecute hardcoded deleteReferences(referenceIds, false), so choosing only "Remove reference(s)" (the recommended action for the common single-reference case) suppressed all success/error feedback and never closed the dialog or reloaded, even though the DELETE request succeeded server-side. Replaced with a combined completion handler that always surfaces success/error/queued-task status regardless of which action(s) ran, and also fixes excludeReferences silently claiming success on a 202 (queued Celery task) response instead of surfacing it like ReferenceForm.jsx already does for Add References. 2. Each resource row's RadioGroup used the literal name="reference-action", shared across every row rendered in the same dialog. Native HTML radio grouping is scoped by name across the whole page, not per React component instance, so selecting more than one resource collapsed all rows into a single mutually-exclusive group -- only one radio in the entire dialog could end up checked, regardless of each row's own recommendation. Scoped the name per row via resource.uuid.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
MSF reported (ocl_issues#2644) that clicking Execute in the "Remove Resources by Reference" dialog often showed no feedback at all — no success toast, the dialog stayed open, and the page didn't refresh — even though the removal had actually succeeded server-side (confirmed only by manually refreshing the page).
Root-caused to two separate bugs in
CollectionHomeChildrenList.jsx:Feedback suppressed on the plain-delete path.
onExecutecalleddeleteReferences(referenceIds, false), hardcodingalert=false. SincedeleteReferencesonly shows a toast / closes the dialog / reloads whenalertis true, choosing "Remove reference(s)" — the recommended action for the common case where a resource is covered by exactly one reference — produced no feedback whatsoever. The only reason feedback ever appeared was if an "Exclude" action also ran in the same execute (excludeReferenceshad its own success handling), so this was invisible unless a mixed selection happened to be made.Related:
excludeReferences's own success handler ignored the response status entirely, so a202(request queued as an async Celery task, perTaskMixin) was reported as an unconditional "Successfully executed" instead of a queued-status message — unlike the equivalent handling already present inReferenceForm.jsxfor Add References.Shared radio-group
nameacross rows. Each selected resource's row renders its ownRadioGroupfor choosing "Remove reference(s)" vs. "Exclude concept(s)/mapping(s)", but every row used the same literalname="reference-action". Native HTML radio-button grouping is scoped bynameacross the whole page, independent of React component boundaries — so with more than one resource selected, all rows collapsed into a single mutually-exclusive group. Only one radio in the entire dialog could end up checked, regardless of which action was actually recommended for each row.Solution
onExecutenow collects whichever of the delete/exclude requests actually fire into a singlePromise.all, and a newonExecuteCompletehandler always closes the dialog and shows success/error/queued feedback once, based on the actual response status(es) — including surfacing202as "queued" instead of a false "success".RadioGroupnametoresource.uuid, so multi-resource selections no longer interfere with each other's default/checked state.Test plan
ocl-cli: a concept with a single reference (delete path) and a concept with two overlapping references (exclude path, including a queued 202 response).eslintclean on the changed file.Refs OpenConceptLab/ocl_issues#2644