Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -44,6 +44,7 @@ svg.spectrum-Table-sortedIcon {
border-left-style: solid;
border-right-width: 1px;
border-right-style: solid;
flex: 0 0 auto;
}
.spectrum-Table-headCellContents {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export const NestedColumns = Template().bind({});
NestedColumns.storyName = 'nested columns';
NestedColumns.args = {columns: nestedColumns, items};

export const MaxHeight = Template.bind({});
Copy link
Member

Choose a reason for hiding this comment

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

So this actually doesn't render anything
you can run our chromatic storybook if you run the command yarn start:chromatic as defined in our package.json

That aside, I don't think we really need this, we'd really need to test it against the async version to meet your reproduction from what you've said. It also looks like the Template is not applying the maxHeight where you expect.

I think it's plenty this time to just contribute the fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, despite my initial report I think this bug occurs even with non-async lists, so I'll spend a bit of time to see if I can get this working. I wasn't aware I could run Chromatic locally without a token, that should help.

So this actually doesn't render anything

Is this because I am (mistakenly) not calling Template?

Copy link
Member

@snowystinger snowystinger May 27, 2022

Choose a reason for hiding this comment

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

Honestly, I didn't dig into why it wasn't rendering anything. If it happens in the non-async case, that'd be immensely helpful. Is it easy to reproduce?

I'd check the definition of Template a little further up in the file, looks like it already has a maxHeight on the TableView. You also don't need to use the Template, you can just return a component. So if you have a reproduction case, you could just copy it in and it should work.

If this is taking too much time, I'm really ok with just the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got the Chromatic test working using a literal component which demonstrates the bug if the CSS line is commented out. Thanks for the pointers!

MaxHeight.storyName = 'maxHeight defined';
MaxHeight.args = {columns, items, maxHeight: 'size-100'};

export const Empty = EmptyTemplate().bind({});
Empty.storyName = 'empty table';
Empty.args = {};
5 changes: 4 additions & 1 deletion packages/@react-spectrum/table/test/Table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ describe('TableView', function () {
});

beforeEach(() => {
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => cb());
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => {
Copy link
Member

Choose a reason for hiding this comment

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

can we revert this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, will do.

cb(0);
return 0;
});
});

afterEach(() => {
Expand Down