dengliming opened a new issue, #610: URL: https://github.com/apache/shenyu-dashboard/issues/610
## Description `onDeleteItem` removes rows with `value.filter(item => item.key !== key)`, i.e. by the header *name* rather than by row index. `onAddItem` assigns `index: value.length`, which collides with existing indexes after any deletion. `onChangeItem` matches rows on `item.index`, so colliding indexes make one edit update two rows. The same component is reused for the query-parameter editor. ## Location (Lines refer to `master @ 83969a5`.) - `src/routes/Document/components/HeadersEditor.js:40-45` (delete/add) - `src/routes/Document/components/HeadersEditor.js:81` (delete button passes `item.key`) ## Impact Click "+ Add header" twice (both rows have key `""`) and delete one: both disappear. With rows `[0,1,2]`, delete row 1 then add a row: the new row gets index `2`, producing a React key collision and edits that apply to two rows. ## Suggested fix Delete by `item.index` (pass `item.index` from the button) and generate indexes with a monotonically increasing counter (or `Math.max(...indexes) + 1`) instead of `value.length`. ## Related existing None -- 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]
