Skip to content

Commit 904f0e3

Browse files
author
Marc-André Rivet
committed
Merge remote-tracking branch 'origin/dev'
- update build artifacts
2 parents 8202224 + 5c82e19 commit 904f0e3

30 files changed

+433
-424
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [1.7.0] - 2019-11-27
6+
### Added
7+
- [#967](https://github.com/plotly/dash/pull/967) Add support for defining
8+
clientside JavaScript callbacks via inline strings.
9+
- [#1020](https://github.com/plotly/dash/pull/1020) Allow `visit_and_snapshot` API in `dash.testing.browser` to stay on the page so you can run other checks.
10+
11+
### Changed
12+
- [#1026](https://github.com/plotly/dash/pull/1026) Better error message when you forget to wrap multiple `children` in an array, and they get passed to other props.
13+
14+
### Fixed
15+
- [#1018](https://github.com/plotly/dash/pull/1006) Fix the `dash.testing` **stop** API with process application runner in Python2. Use `kill()` instead of `communicate()` to avoid hanging.
16+
- [#1027](https://github.com/plotly/dash/pull/1027) Fix bug with renderer callback lock never resolving with non-rendered async component using the asyncDecorator
17+
518
## [1.6.1] - 2019-11-14
619
### Fixed
720
- [#1006](https://github.com/plotly/dash/pull/1006) Fix IE11 / ES5 compatibility and validation issues

dash-renderer/dash_renderer/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22

33
__file__
4-
__version__ = "1.2.0"
4+
__version__ = "1.2.2"
55

66
_js_dist_dependencies = [
77
{
@@ -42,7 +42,7 @@
4242
{
4343
"relative_package_path": "{}.min.js".format(__name__),
4444
"dev_package_path": "{}.dev.js".format(__name__),
45-
"external_url": "https://unpkg.com/[email protected].0"
45+
"external_url": "https://unpkg.com/[email protected].2"
4646
"/dash_renderer/dash_renderer.min.js",
4747
"namespace": "dash_renderer",
4848
},

dash-renderer/dash_renderer/dash_renderer.dev.js

Lines changed: 73 additions & 188 deletions
Large diffs are not rendered by default.

dash-renderer/dash_renderer/dash_renderer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash-renderer/digest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"MD5 (dash_renderer.dev.js)":"5c8dd18a7219a02a2bba18fa3745e956",
3-
"MD5 (dash_renderer.min.js)":"42000353e8f0b5f4abf96ea9ee0f3a49",
2+
"MD5 (dash_renderer.dev.js)":"9f94b1dfda81223a2f277573cc4d34af",
3+
"MD5 (dash_renderer.min.js)":"50050e60b65a8982d75e83b7760324dd",
44
"MD5 ([email protected])":"ed6472b73ae010eee88282933a04c2a1",
55
"MD5 ([email protected])":"85947944e396a28895fad5f553eee36f",
66
"MD5 ([email protected])":"e3053393609bd2744010498629a43597",
77
"MD5 ([email protected])":"d7f8afaf3370a228c8d5c802c9d9a102",
88
"MD5 ([email protected])":"fad5842bd019c3878795ec52059f47fc",
99
"MD5 ([email protected])":"bb95f4cd851114c374c3858e9c51da10",
1010
"MD5 ([email protected])":"f808b8e8ab51b0d9525795db3768cd86",
11-
"dash-renderer":"1.2.0"
11+
"dash-renderer":"1.2.2"
1212
}

dash-renderer/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash-renderer/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-renderer",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "render dash components in react",
55
"main": "dash_renderer/dash_renderer.min.js",
66
"scripts": {
@@ -67,4 +67,4 @@
6767
"webpack-serve": "^3.1.1",
6868
"whatwg-fetch": "^2.0.2"
6969
}
70-
}
70+
}

dash-renderer/src/APIController.react.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
computePaths,
1010
hydrateInitialOutputs,
1111
setLayout,
12-
setAppIsReady,
1312
} from './actions/index';
1413
import {applyPersistence} from './persistence';
1514
import apiThunk from './actions/api';
@@ -55,7 +54,6 @@ class UnconnectedContainer extends Component {
5554
dispatch
5655
);
5756
dispatch(setLayout(finalLayout));
58-
dispatch(setAppIsReady());
5957
} else if (isNil(paths)) {
6058
dispatch(computePaths({subTree: layout, startingPath: []}));
6159
}

dash-renderer/src/actions/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const actionList = {
88
SET_CONFIG: 'SET_CONFIG',
99
ON_ERROR: 'ON_ERROR',
1010
SET_HOOKS: 'SET_HOOKS',
11-
SET_APP_READY: 'SET_APP_READY',
1211
};
1312

1413
export const getAction = action => {

dash-renderer/src/actions/index.js

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
slice,
2424
sort,
2525
type,
26+
uniq,
2627
view,
2728
} from 'ramda';
2829
import {createAction} from 'redux-actions';
@@ -33,7 +34,8 @@ import cookie from 'cookie';
3334
import {uid, urlBase, isMultiOutputProp, parseMultipleOutputs} from '../utils';
3435
import {STATUS} from '../constants/constants';
3536
import {applyPersistence, prunePersistence} from '../persistence';
36-
import setAppIsReady from './setAppReadyState';
37+
38+
import isAppReady from './isAppReady';
3739

3840
export const updateProps = createAction(getAction('ON_PROP_CHANGE'));
3941
export const setRequestQueue = createAction(getAction('SET_REQUEST_QUEUE'));
@@ -45,8 +47,6 @@ export const setHooks = createAction(getAction('SET_HOOKS'));
4547
export const setLayout = createAction(getAction('SET_LAYOUT'));
4648
export const onError = createAction(getAction('ON_ERROR'));
4749

48-
export {setAppIsReady};
49-
5050
export function hydrateInitialOutputs() {
5151
return function(dispatch, getState) {
5252
triggerDefaultState(dispatch, getState);
@@ -221,11 +221,13 @@ export function notifyObservers(payload) {
221221
return async function(dispatch, getState) {
222222
const {id, props, excludedOutputs} = payload;
223223

224-
const {graphs, isAppReady, requestQueue} = getState();
225-
226-
if (isAppReady !== true) {
227-
await isAppReady;
228-
}
224+
const {
225+
dependenciesRequest,
226+
graphs,
227+
layout,
228+
paths,
229+
requestQueue,
230+
} = getState();
229231

230232
const {InputGraph} = graphs;
231233
/*
@@ -365,6 +367,30 @@ export function notifyObservers(payload) {
365367
}
366368
});
367369

370+
/**
371+
* Determine the id of all components used as input or state in the callbacks
372+
* triggered by the props change.
373+
*
374+
* Wait for all components associated to these ids to be ready before initiating
375+
* the callbacks.
376+
*/
377+
const deps = queuedObservers.map(output =>
378+
dependenciesRequest.content.find(
379+
dependency => dependency.output === output
380+
)
381+
);
382+
383+
const ids = uniq(
384+
flatten(
385+
deps.map(dep => [
386+
dep.inputs.map(input => input.id),
387+
dep.state.map(state => state.id),
388+
])
389+
)
390+
);
391+
392+
await isAppReady(layout, paths, ids);
393+
368394
/*
369395
* record the set of output IDs that will eventually need to be
370396
* updated in a queue. not all of these requests will be fired in this
@@ -950,8 +976,6 @@ function updateOutput(
950976
);
951977
});
952978
}
953-
954-
dispatch(setAppIsReady());
955979
}
956980
};
957981
if (multi) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {path} from 'ramda';
2+
import {isReady} from '@plotly/dash-component-plugins';
3+
4+
import Registry from '../registry';
5+
6+
export default (layout, paths, targets) => {
7+
const promises = [];
8+
targets.forEach(id => {
9+
const pathOfId = paths[id];
10+
if (!pathOfId) {
11+
return;
12+
}
13+
14+
const target = path(pathOfId, layout);
15+
if (!target) {
16+
return;
17+
}
18+
19+
const component = Registry.resolve(target);
20+
const ready = isReady(component);
21+
22+
if (ready && typeof ready.then === 'function') {
23+
promises.push(ready);
24+
}
25+
});
26+
27+
return promises.length ? Promise.all(promises) : true;
28+
};

dash-renderer/src/actions/setAppReadyState.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

dash-renderer/src/reducers/isAppReady.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

dash-renderer/src/reducers/reducer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
view,
1111
} from 'ramda';
1212
import {combineReducers} from 'redux';
13-
import isAppReady from './isAppReady';
1413
import layout from './layout';
1514
import graphs from './dependencyGraph';
1615
import paths from './paths';
@@ -32,7 +31,6 @@ export const apiRequests = [
3231
function mainReducer() {
3332
const parts = {
3433
appLifecycle,
35-
isAppReady,
3634
layout,
3735
graphs,
3836
paths,
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import isAppReady from "../src/actions/isAppReady";
2+
3+
const WAIT = 1000;
4+
5+
describe('isAppReady', () => {
6+
let resolve;
7+
beforeEach(() => {
8+
const promise = new Promise(r => {
9+
resolve = r;
10+
});
11+
12+
window.__components = {
13+
a: { _dashprivate_isLazyComponentReady: promise },
14+
b: {}
15+
};
16+
});
17+
18+
it('executes if app is ready', async () => {
19+
let done = false;
20+
Promise.resolve(isAppReady(
21+
[{ namespace: '__components', type: 'b', props: { id: 'comp1' } }],
22+
{ comp1: [0] },
23+
['comp1']
24+
)).then(() => {
25+
done = true
26+
});
27+
28+
await new Promise(r => setTimeout(r, WAIT));
29+
expect(done).toEqual(true);
30+
});
31+
32+
it('waits on app to be ready', async () => {
33+
let done = false;
34+
Promise.resolve(isAppReady(
35+
[{ namespace: '__components', type: 'a', props: { id: 'comp1' } }],
36+
{ comp1: [0] },
37+
['comp1']
38+
)).then(() => {
39+
done = true
40+
});
41+
42+
await new Promise(r => setTimeout(r, WAIT));
43+
expect(done).toEqual(false);
44+
45+
resolve();
46+
47+
await new Promise(r => setTimeout(r, WAIT));
48+
expect(done).toEqual(true);
49+
});
50+
});

0 commit comments

Comments
 (0)