-
-
Notifications
You must be signed in to change notification settings - Fork 72
Issue 384 - Handling of None
data and columns props
#731
Conversation
What about if callbacks update an empty datatable dynamically? app.layout = html.Div([
html.Label('Select a dataset'),
dcc.Dropdown(options=[...], value=..., id='dropdown'),
dash_table.DataTable(id='table')
])
@app.callback(Output('table', 'data'), [Input('dropdown', va'lue')])
def ... |
@chriddyp Good point. Updated the internal validation/sanitation logic to instead handle that case gracefully. |
data
and columns
are required propsNone
data and columns props
- remove default value for data and columns - sanitize data and columns props - update columns prop validation - update TypeScript types
assert target.is_ready() | ||
test.driver.find_element_by_css_selector("#clear-table").click() | ||
assert target.is_ready() | ||
assert len(test.driver.find_elements_by_css_selector("tr")) == 0 |
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.
Once the callback returns, the table should (1) load successfully and get to the ready state, (2) should contain no rows.
TDD'ed locally, can undo redo the fix in the PR if we'd rather have the demonstration.
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'm fine with not seeing the test fail on CI - I assume we're all running our own tests with the fix disabled. But it would be nice to have this test check for the proper number of <tr>
elements before the clear-table
.
Also, given that you have the is_ready()
method this may not be helpful, but in wildcards I added a wait_for_no_elements
method
# Conflicts: # CHANGELOG.md
- add pytest.ini with `testpaths`
testpaths = tests/ | ||
addopts = -rsxX -vv | ||
log_format = %(asctime)s | %(levelname)s | %(name)s:%(lineno)d | %(message)s | ||
log_cli_level = ERROR |
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.
Same as for DCC - accelerates -k
test runs
plotly/dash-core-components#740
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.
💃
Closes #384
Changes table validation/sanitation to handle
data=None
andcolumns=None
without throwing an error.