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

Renderer regression #496

Merged
merged 13 commits into from
Mar 25, 2019
Merged

Renderer regression #496

merged 13 commits into from
Mar 25, 2019

Conversation

Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Mar 23, 2019

May require a changelog entry if this and plotly/dash-renderer#140 fixes the behavior encountered by community with dynamically loaded LCs. @valentijnnieman will want to go over that one with you.

@@ -27,7 +27,7 @@ jobs:
name: Install dependencies (dash)
command: |
git clone git@github.com:plotly/dash.git
git clone git@github.com:plotly/dash-renderer.git
git clone -b renderer-regression git@github.com:plotly/dash-renderer.git
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be removed once in master

const isLoading = getLoadingState(this);

if (isLoading) {
if (loading_state && loading_state.is_loading) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The nested loading state is already determined by the renderer. Only need to check the prop value

@@ -62,6 +61,8 @@ export default class Loading extends Component {
}
}

Loading._dashprivate_deepstate = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

set the deepstate flag for nested loading state

child => child.type !== Loading && getLoadingState(child),
Array.isArray(children) ? children : [children]
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is resolved by the renderer, no longer needed

@@ -28,7 +28,7 @@ const CircleSpinner = ({
return (
<div style={style ? style : {}} className={spinnerClass}>
{debugTitle}
<div className="dash-sk-circle">
<div className="dash-spinner dash-sk-circle">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extra class on the spinners, easier to target general spinner through css (and to automate tests)

@@ -19,18 +19,18 @@ const GraphSpinner = ({status, fullscreen, debug, className, style}) => {
<div style={style ? style : {}} className={spinnerClass}>
<div>
{debugTitle}
<div className="dash-spinner">
<div className="dash-spinner__bottom">
<div className="dash-spinner dash-graph-spinner">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dash-spinner and variants become dash-graph-spinner

with lock:
return 'content'

with lock:
Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet Mar 23, 2019

Choose a reason for hiding this comment

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

Using with lock instead of lock.acquire() / lock.release() as a test failure will throw an error and will prevent the lock from being released -- hence the test app will never terminate, blocking the tests indefinitely!

with lock:
    // Code

is equivalent to

try {
   lock.acquire()
    // Code
} finally {
    lock.release()
}

Including @plotly/dash to update previously tagged info in #486 (comment).

@@ -216,9 +216,306 @@ def test_upload_gallery(self):

self.snapshot('test_upload_gallery')

def test_loading_component_initialization(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

5 scenarios are tested here

  • LC works on initial callback execution
  • LC works on triggered callback
  • multiple LCs have independent states
  • nested LCs get pruned from parent's state
  • dynamically loaded LCs work

lock.acquire()
lock.release()
return 5
with lock:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing tests previously written with lock.acquire() / lock.release()

}
</style>"
`;
exports[`Loading checks all it's children for a loading_state: Loading spinner for children 1`] = `"<div>Child 1</div><div>Child 2</div><div loading_state=\\"[object Object]\\">Child 3</div>"`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

new dash-spinner class changes the jest snapshots

@Marc-Andre-Rivet Marc-Andre-Rivet marked this pull request as ready for review March 23, 2019 02:18

self.wait_for_element_by_css_selector(
'#horizontal-slider[data-dash-is-loading="true"]'
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding to the test -- we don't only check that the loading state is ok on initialization, also check that it's ok on user initiated actions


self.wait_for_element_by_css_selector(
'#horizontal-range-slider[data-dash-is-loading="true"]'
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Init and user action cases, as above

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

Looks great, only question is the flag name plotly/dash-renderer#140 (review)

@Marc-Andre-Rivet
Copy link
Contributor Author

Local testing: confirming that 2 graphs with different figures test showing Loading... is a timing issue.

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit da9e5e3 into master Mar 25, 2019
@Marc-Andre-Rivet Marc-Andre-Rivet changed the title [WIP] Renderer regression Renderer regression Mar 25, 2019
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the renderer-regression branch March 25, 2019 13:26
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