-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Columns dialog clean attribute ids before send it to GridAttributes operation #476
Columns dialog clean attribute ids before send it to GridAttributes operation #476
Conversation
Codecov Report
@@ Coverage Diff @@
## master #476 +/- ##
=======================================
Coverage 72.39% 72.39%
=======================================
Files 658 658
Lines 7440 7440
Branches 1227 1227
=======================================
Hits 5386 5386
Misses 1819 1819
Partials 235 235 Continue to review full report at Codecov.
|
I have no idea what problem this PR solves. Would you mind explaining it? |
@dominik-zeglen After the PR 5460 the API is expecting valid IDs in the filter otherwise it will raise a GraphQLError. In the Dashboard, the feature to add more columns in the list of products was not working because we were sending invalid IDs like I updated the description of the PR, the images had an incorrect title. |
const columnIdsFilter = columns => { | ||
columns = columns.filter(column => isAttributeColumnValue(column)); | ||
columns.forEach( | ||
(attribute, index, arr) => | ||
(arr[index] = getAttributeIdFromColumnValue(attribute)) | ||
); | ||
return columns; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be shortened to
function filterColumnIds(columns: ProductListColumns[]) {
return columns.filter(isAttributeColumnValue).map(getAttributeIdFromColumnValue)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, working on it. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we could move it to utils in the component to be able to reuse it in other places as we need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, it's specific for the available query in that view. I updated the description to include issue #478 created today.
Done, please review it again and thank you for the feedback :)
I want to merge this change because it resolves the issue that was sending invalid ids to GridAttributes operation and it was getting an error from the API and frozen the dialog to add/remove columns.
Fix #478
Screenshots
Sending Invalid ids before the changes
Sending valid ids after the changes
Pull Request Checklist