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(table): render cells even if data is falsy #7914

Merged
merged 4 commits into from Oct 30, 2017

Conversation

andrewseguin
Copy link
Contributor

This was an optimization assuming that undefined data was meant to create a row without cells. This is a faulty design decision and the logic is incorrect anyways (see issue, 0 and other falsy values caused empty rows).

Supported workaround to rendering empty rows is to use the when predicate that can define a row without columns.

Fixes #7902

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 19, 2017
@andrewseguin andrewseguin added pr: needs review and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Oct 19, 2017
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@josephperrott josephperrott added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Oct 20, 2017
@andrewseguin andrewseguin added the P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful label Oct 20, 2017
const cells = rowData ? this._getCellTemplatesForRow(row) : [];

cells.forEach(cell => {
this._getCellTemplatesForRow(row).forEach(cell => {
Copy link
Member

Choose a reason for hiding this comment

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

Needs a unit test

@jelbourn jelbourn removed the action: merge The PR is ready for merge by the caretaker label Oct 20, 2017
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 20, 2017
@andrewseguin
Copy link
Contributor Author

Added a unit test

</cdk-table>
`
})
class EvenSimplerCdkTableApp {
Copy link
Member

Choose a reason for hiding this comment

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

TableWithBooleanDataSource?

("EvenSimpler" doesn't tell you anything really)

@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Oct 23, 2017
@@ -109,10 +109,10 @@ describe('CdkTable', () => {
});

it('should render cells even if row data is falsy', () => {
const evenSimplerCdkTableAppFixture = TestBed.createComponent(EvenSimplerCdkTableApp);
const booleanRowCdkTableAppFixture = TestBed.createComponent(EvenSimplerCdkTableApp);
Copy link
Member

Choose a reason for hiding this comment

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

Name of the component too?
EvenSimplerCdkTableApp -> TableWithBooleanDataSource

Copy link
Contributor Author

Choose a reason for hiding this comment

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

d'oh yes - my brain was thinking they were all renaming

@mmalerba mmalerba merged commit f601e83 into angular:master Oct 30, 2017
@andrewseguin andrewseguin deleted the table-fix-cell-bug branch November 28, 2017 20:38
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Table] Cells do not render if data is falsy
5 participants