Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jira): More explicitly excise itemKey in removeRow #28664

Merged
merged 1 commit into from
Sep 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ export default class ChoiceMapper extends React.Component<FieldProps> {

const removeRow = (itemKey: string) => {
// eslint-disable-next-line no-unused-vars
const {[itemKey]: _, ...updatedValue} = value;
saveChanges(updatedValue);
saveChanges(
Object.fromEntries(Object.entries(value).filter(([key, _]) => key !== itemKey))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.fromEntries(Object.entries(value).filter(([key]) => key !== itemKey))

You don't need the underscore, you would only need that if you didn't care about earlier indexes in the array.

);
Comment on lines +143 to +145
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put the saveChanges param to a clearer identifier or write a comment explaining what is happening here for readability purpose.

};

const setValue = (
Expand Down