Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Remove events #114

Merged
merged 12 commits into from
Jan 21, 2019
Merged

Remove events #114

merged 12 commits into from
Jan 21, 2019

Conversation

alexcjohnson
Copy link
Collaborator

Closes #113
Pretty straightforward, just removing the DepGraph for events (but note that state.graphs is still an object we can add more to, which may be important for multi-outputs and dynamic callbacks to create a modified graph for cycle detection), and all references to fireEvent.

As in plotly/dash-html-components#89 I added a test shortcut to package.json - is there already a way to do this that I didn't see?

There were some (mostly skipped) tests of events, and rather than
removing them, I adapted them to the corresponding event properties.
This had the nice effects of 1) showing that the event behavior
that was listed as broken is not broken as properties, and
2) pointing out the need to skip the first call (using PreventUpdate)
if we want an exact match to the old event behavior.
package.json Outdated
@@ -13,7 +13,8 @@
"start": "webpack-serve ./webpack.serve.config.js",
"format": "prettier --config .prettierrc --write src/**/*.js",
"format:test": "prettier --config .prettierrc src/**/*.js --list-different",
"test": "npm run lint"
"test": "npm run lint",
"test:py": "python -m unittest tests.test_render.Tests && python -m unittest tests.test_race_conditions.Tests"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update CircleCI config to use this command instead

@Marc-Andre-Rivet
Copy link
Contributor

I think this Event should also be removed

from dash.dependencies import Input, Output, State, Event

@Marc-Andre-Rivet
Copy link
Contributor

Missing a changelog entry.

@Marc-Andre-Rivet
Copy link
Contributor

Marc-Andre-Rivet commented Jan 10, 2019

Getting errors when running dash-docs with this version of dash-renderer.
Seems like one usage of updateOutput in src/actions/index.js was not updated

Need to remove the null event.

Not sure if this is what's getting caught by the failing tests or something else.

@alexcjohnson
Copy link
Collaborator Author

Seems like one usage of updateOutput in src/actions/index.js was not updated

Good catch! updated that in c4a9a22. It seems like the dash-renderer tests don't touch this unfortunately, but it's a bit tough as I get a few failures with these tests locally even on master. Not going to try and sort that out in this PR, but I'll see if I can add a test that covers that updateOutput call.

if not n_clicks:
# initial value is quick, only new value is slow
# also don't let the initial value increment call_counts
return 'Initial Value'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand how this test was passing on master - it failed for me locally, and failed in this branch on ci, until this fix.

if get_message:
message = get_message()
elif expected_value:
message = 'Final value: {}'.format(condition_val)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would have helped me debug test_removing_component_while_its_getting_updated - I thought the callback wasn't getting called at all, when in fact it was called too many times! With expected_value you can get error messages like:

======================================================================
ERROR: test_removing_component_while_its_getting_updated (tests.test_render.Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/test_render.py", line 1423, in test_removing_component_while_its_getting_updated
    wait_for(lambda: call_counts['button-output'].value, expected_value=1)
  File "tests/utils.py", line 72, in wait_for
    raise WaitForTimeout(message)
WaitForTimeout: Final value: 2

Which would have made it much clearer what was going on.

Would be nice if we could share utils like this across dash repos - perhaps if we split out dash_development things like this could go there?

@alexcjohnson
Copy link
Collaborator Author

Seems like one usage of updateOutput in src/actions/index.js was not updated

Good catch! updated that in c4a9a22. It seems like the dash-renderer tests don't touch this unfortunately, but it's a bit tough as I get a few failures with these tests locally even on master. Not going to try and sort that out in this PR, but I'll see if I can add a test that covers that updateOutput call.

Aaaactually we did have a test that covered this case: test_callbacks_triggered_on_generated_output - not sure how I missed that the first time, but anyway I made that test a bit clearer in 57ef3b2

@Marc-Andre-Rivet
Copy link
Contributor

@alexcjohnson So, I haven't digged enough in renderer to have a fully formed opinion but a few things already come to mind -- obviously nothing in here is in the scope for this PR!

  • would very probably benefit from using a typing library
  • fine grained testing is HARD when you're only doing integration/e2e tests.. secondary observations used to deduce underlying behavior -- most of the tests of that sort should pbly live in the comps source repo (and potentially be called as additional tests by this repo)
  • some tests depend on implementation details of components in dcc and html -- internally defined comps for specfic tests would be better
  • def would like to push some shared configurations somewhere else! ts/es/lint configs, version/deployment scripts, etc.

Copy link
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.

💃

@alexcjohnson alexcjohnson merged commit ed06794 into master Jan 21, 2019
@alexcjohnson alexcjohnson deleted the no-events branch January 21, 2019 22:13
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.

2 participants