Skip to content

[6.x] Keep listing columns when the response doesn't include any - #15801

Open
duncanmcclean wants to merge 1 commit into
6.xfrom
listing-missing-columns
Open

duncanmcclean wants to merge 1 commit into
6.xfrom
listing-missing-columns

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where clicking a column header on a custom listing would throw TypeError: can't access property "filter", columns.value is undefined.

This was happening because the Listing component replaces its columns with meta.columns from every response. Core resources always return them, but custom JSON endpoints (eg. a resource collection in an addon) don't have to. When they're missing, the columns become undefined and anything reading them, like sorting, blows up.

This PR fixes it by only replacing the columns when the response actually includes them, otherwise the listing keeps the columns it was given as a prop.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants