fix(scripting): derive run device order from the device list instead of storing it - #1170
Merged
Merged
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
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.
Follow-up to #1167, addressing the Codex review finding on #1169.
#1167 ordered
ui.selectedby device-list position at selection time and stored that order. Codex correctly flagged that the order goes stale: changing the sort inFilterDrawercallsdevices.set({ sort })+fetchList(), which reorders the list without any selection click, sosortSelectedIdsnever re-runs. The run form then displays — and submits — the old order.List position is mutable, so any stored copy of it can drift. The same applies to filtering, searching, and paging, not just sorting. Deriving the order at the point of display removes the whole class of staleness.
Changes
ScriptRunPage.resolvedDevicesnow orders by device-list index. It's already auseMemooverdevices, so it recomputes when the list reorders — no extra work, and it coversSELECTEDandCUSTOMalike.handleRun/handlePreparesubmitresolvedDevices.map(d => d.id), so what's displayed is what's sent.CUSTOMruns are now ordered too, where before onlySELECTEDwas touched.sortSelectedIdsis deleted fromhelpers/selectionRange.tsanduseSelectno longer calls it, soui.selectedgoes back to plain click order.Net effect: 14 insertions, 18 deletions — this removes more than it adds.
Notes
useSelectsimplification from fix(scripting): sort selected devices by name when added #1167 (collapsed duplicate branches, single dispatch) stays; only the sort call is removed.ui.selectedto click order also undoes fix(scripting): sort selected devices by name when added #1167's side effect on the other bulk device actions (tagging, transfer, delete), which never wanted an imposed order.Testing
tsc --noEmitpasses. Not exercised in the running app. The case worth clicking through is the one Codex described: select several devices, change the device list sort, then open the run form and confirm the chips follow the new sort.