Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Make id prop of table optional#155

Merged
valentijnnieman merged 11 commits intomasterfrom
139-optional-id
Oct 23, 2018
Merged

Make id prop of table optional#155
valentijnnieman merged 11 commits intomasterfrom
139-optional-id

Conversation

@valentijnnieman
Copy link
Copy Markdown
Contributor

This closes #139. Makes the id prop optional, and generates a random id in defaultProps. I've taken the genRandomId function from dash core components, let me know if that's adequate. Also please let me know if the visual tests are enough!

'table-' +
Math.random()
.toString(s)
.substring(2, l)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why cut the substring when you could just do .substring(2)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So that they're always the same length? I'll remove that.

beforeEach(() => cy.visit('http://localhost:8081'));

it('can select row', () => {
it.only('can select row', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove .only

"lint": "run-s private::lint.js private::lint.ts",
"test": "run-p --race private::host* private::runtests",
"test.visual": "build-storybook && percy-storybook",
"test.visual-local": "build-storybook",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

column_conditional_dropdowns: [],
column_static_dropdown: [],

id: genRandomId(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If there are multiple tables, won't this be executed once and all default-id tables will share the same id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this will be executed for every time you call <Table />. So no, it won't be shared if there are multiple tables.

row_deletable={true}
row_selectable={true}
style_data_conditional={style_data_conditional}
/>))
Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet Oct 22, 2018

Choose a reason for hiding this comment

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

I think the best visual test would involve

  1. two tables w/o id
  2. include at least one selector/rule with the css prop (as for all implementations of the table, these are guaranteed to be using a stylesheet and apply the table id selector) -- implementation details may change for style_*

Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

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

Off to a good start. Check comments. Should also bump version and add an entry in changelog.md

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-155 October 22, 2018 20:28 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-155 October 23, 2018 15:04 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-155 October 23, 2018 15:25 Inactive
@valentijnnieman
Copy link
Copy Markdown
Contributor Author

@Marc-Andre-Rivet Ready for re-reviewing!

@valentijnnieman
Copy link
Copy Markdown
Contributor Author

Actually, could you help me out with the changelog? Should bump version to rc7 and a RC7 header in the changelog?

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-155 October 23, 2018 16:44 Inactive
Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@valentijnnieman valentijnnieman merged commit e7a7629 into master Oct 23, 2018
@alexcjohnson alexcjohnson deleted the 139-optional-id branch April 22, 2019 06:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can we make the id prop optional?

3 participants