Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
- update build artifacts
  • Loading branch information
Marc-André Rivet committed Nov 27, 2019
2 parents 8202224 + 5c82e19 commit 904f0e3
Show file tree
Hide file tree
Showing 30 changed files with 433 additions and 424 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.7.0] - 2019-11-27
### Added
- [#967](https://github.com/plotly/dash/pull/967) Add support for defining
clientside JavaScript callbacks via inline strings.
- [#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.

### Changed
- [#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.

### Fixed
- [#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.
- [#1027](https://github.com/plotly/dash/pull/1027) Fix bug with renderer callback lock never resolving with non-rendered async component using the asyncDecorator

## [1.6.1] - 2019-11-14
### Fixed
- [#1006](https://github.com/plotly/dash/pull/1006) Fix IE11 / ES5 compatibility and validation issues
Expand Down
4 changes: 2 additions & 2 deletions dash-renderer/dash_renderer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

__file__
__version__ = "1.2.0"
__version__ = "1.2.2"

_js_dist_dependencies = [
{
Expand Down Expand Up @@ -42,7 +42,7 @@
{
"relative_package_path": "{}.min.js".format(__name__),
"dev_package_path": "{}.dev.js".format(__name__),
"external_url": "https://unpkg.com/[email protected].0"
"external_url": "https://unpkg.com/[email protected].2"
"/dash_renderer/dash_renderer.min.js",
"namespace": "dash_renderer",
},
Expand Down
261 changes: 73 additions & 188 deletions dash-renderer/dash_renderer/dash_renderer.dev.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dash-renderer/dash_renderer/dash_renderer.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dash-renderer/digest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"MD5 (dash_renderer.dev.js)":"5c8dd18a7219a02a2bba18fa3745e956",
"MD5 (dash_renderer.min.js)":"42000353e8f0b5f4abf96ea9ee0f3a49",
"MD5 (dash_renderer.dev.js)":"9f94b1dfda81223a2f277573cc4d34af",
"MD5 (dash_renderer.min.js)":"50050e60b65a8982d75e83b7760324dd",
"MD5 ([email protected])":"ed6472b73ae010eee88282933a04c2a1",
"MD5 ([email protected])":"85947944e396a28895fad5f553eee36f",
"MD5 ([email protected])":"e3053393609bd2744010498629a43597",
"MD5 ([email protected])":"d7f8afaf3370a228c8d5c802c9d9a102",
"MD5 ([email protected])":"fad5842bd019c3878795ec52059f47fc",
"MD5 ([email protected])":"bb95f4cd851114c374c3858e9c51da10",
"MD5 ([email protected])":"f808b8e8ab51b0d9525795db3768cd86",
"dash-renderer":"1.2.0"
"dash-renderer":"1.2.2"
}
2 changes: 1 addition & 1 deletion dash-renderer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dash-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-renderer",
"version": "1.2.1",
"version": "1.2.2",
"description": "render dash components in react",
"main": "dash_renderer/dash_renderer.min.js",
"scripts": {
Expand Down Expand Up @@ -67,4 +67,4 @@
"webpack-serve": "^3.1.1",
"whatwg-fetch": "^2.0.2"
}
}
}
2 changes: 0 additions & 2 deletions dash-renderer/src/APIController.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
computePaths,
hydrateInitialOutputs,
setLayout,
setAppIsReady,
} from './actions/index';
import {applyPersistence} from './persistence';
import apiThunk from './actions/api';
Expand Down Expand Up @@ -55,7 +54,6 @@ class UnconnectedContainer extends Component {
dispatch
);
dispatch(setLayout(finalLayout));
dispatch(setAppIsReady());
} else if (isNil(paths)) {
dispatch(computePaths({subTree: layout, startingPath: []}));
}
Expand Down
1 change: 0 additions & 1 deletion dash-renderer/src/actions/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const actionList = {
SET_CONFIG: 'SET_CONFIG',
ON_ERROR: 'ON_ERROR',
SET_HOOKS: 'SET_HOOKS',
SET_APP_READY: 'SET_APP_READY',
};

export const getAction = action => {
Expand Down
44 changes: 34 additions & 10 deletions dash-renderer/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
slice,
sort,
type,
uniq,
view,
} from 'ramda';
import {createAction} from 'redux-actions';
Expand All @@ -33,7 +34,8 @@ import cookie from 'cookie';
import {uid, urlBase, isMultiOutputProp, parseMultipleOutputs} from '../utils';
import {STATUS} from '../constants/constants';
import {applyPersistence, prunePersistence} from '../persistence';
import setAppIsReady from './setAppReadyState';

import isAppReady from './isAppReady';

export const updateProps = createAction(getAction('ON_PROP_CHANGE'));
export const setRequestQueue = createAction(getAction('SET_REQUEST_QUEUE'));
Expand All @@ -45,8 +47,6 @@ export const setHooks = createAction(getAction('SET_HOOKS'));
export const setLayout = createAction(getAction('SET_LAYOUT'));
export const onError = createAction(getAction('ON_ERROR'));

export {setAppIsReady};

export function hydrateInitialOutputs() {
return function(dispatch, getState) {
triggerDefaultState(dispatch, getState);
Expand Down Expand Up @@ -221,11 +221,13 @@ export function notifyObservers(payload) {
return async function(dispatch, getState) {
const {id, props, excludedOutputs} = payload;

const {graphs, isAppReady, requestQueue} = getState();

if (isAppReady !== true) {
await isAppReady;
}
const {
dependenciesRequest,
graphs,
layout,
paths,
requestQueue,
} = getState();

const {InputGraph} = graphs;
/*
Expand Down Expand Up @@ -365,6 +367,30 @@ export function notifyObservers(payload) {
}
});

/**
* Determine the id of all components used as input or state in the callbacks
* triggered by the props change.
*
* Wait for all components associated to these ids to be ready before initiating
* the callbacks.
*/
const deps = queuedObservers.map(output =>
dependenciesRequest.content.find(
dependency => dependency.output === output
)
);

const ids = uniq(
flatten(
deps.map(dep => [
dep.inputs.map(input => input.id),
dep.state.map(state => state.id),
])
)
);

await isAppReady(layout, paths, ids);

/*
* record the set of output IDs that will eventually need to be
* updated in a queue. not all of these requests will be fired in this
Expand Down Expand Up @@ -950,8 +976,6 @@ function updateOutput(
);
});
}

dispatch(setAppIsReady());
}
};
if (multi) {
Expand Down
28 changes: 28 additions & 0 deletions dash-renderer/src/actions/isAppReady.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {path} from 'ramda';
import {isReady} from '@plotly/dash-component-plugins';

import Registry from '../registry';

export default (layout, paths, targets) => {
const promises = [];
targets.forEach(id => {
const pathOfId = paths[id];
if (!pathOfId) {
return;
}

const target = path(pathOfId, layout);
if (!target) {
return;
}

const component = Registry.resolve(target);
const ready = isReady(component);

if (ready && typeof ready.then === 'function') {
promises.push(ready);
}
});

return promises.length ? Promise.all(promises) : true;
};
77 changes: 0 additions & 77 deletions dash-renderer/src/actions/setAppReadyState.js

This file was deleted.

8 changes: 0 additions & 8 deletions dash-renderer/src/reducers/isAppReady.js

This file was deleted.

2 changes: 0 additions & 2 deletions dash-renderer/src/reducers/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
view,
} from 'ramda';
import {combineReducers} from 'redux';
import isAppReady from './isAppReady';
import layout from './layout';
import graphs from './dependencyGraph';
import paths from './paths';
Expand All @@ -32,7 +31,6 @@ export const apiRequests = [
function mainReducer() {
const parts = {
appLifecycle,
isAppReady,
layout,
graphs,
paths,
Expand Down
50 changes: 50 additions & 0 deletions dash-renderer/tests/isAppReady.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import isAppReady from "../src/actions/isAppReady";

const WAIT = 1000;

describe('isAppReady', () => {
let resolve;
beforeEach(() => {
const promise = new Promise(r => {
resolve = r;
});

window.__components = {
a: { _dashprivate_isLazyComponentReady: promise },
b: {}
};
});

it('executes if app is ready', async () => {
let done = false;
Promise.resolve(isAppReady(
[{ namespace: '__components', type: 'b', props: { id: 'comp1' } }],
{ comp1: [0] },
['comp1']
)).then(() => {
done = true
});

await new Promise(r => setTimeout(r, WAIT));
expect(done).toEqual(true);
});

it('waits on app to be ready', async () => {
let done = false;
Promise.resolve(isAppReady(
[{ namespace: '__components', type: 'a', props: { id: 'comp1' } }],
{ comp1: [0] },
['comp1']
)).then(() => {
done = true
});

await new Promise(r => setTimeout(r, WAIT));
expect(done).toEqual(false);

resolve();

await new Promise(r => setTimeout(r, WAIT));
expect(done).toEqual(true);
});
});
Loading

0 comments on commit 904f0e3

Please sign in to comment.