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

Send which input fired in update request. #124

Merged
merged 4 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## UNRELEASED
## Added
- Added which properties fired to update prop request. [#124](https://github.com/plotly/dash-renderer/pull/124)

## [0.18.0] - 2019-02-11
### Removed
- Removed redux logger for the dev. [#118](https://github.com/plotly/dash-renderer/pull/118)
Expand Down
19 changes: 15 additions & 4 deletions dash_renderer/dash_renderer.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -34012,7 +34012,9 @@ function notifyObservers(payload) {

var requestUid = newRequestQueue[i].uid;

promises.push(updateOutput(outputComponentId, outputProp, getState, requestUid, dispatch));
promises.push(updateOutput(outputComponentId, outputProp, getState, requestUid, dispatch, changedProps.map(function (prop) {
return id + '.' + prop;
})));
}

/* eslint-disable consistent-return */
Expand All @@ -34021,7 +34023,7 @@ function notifyObservers(payload) {
};
}

function updateOutput(outputComponentId, outputProp, getState, requestUid, dispatch) {
function updateOutput(outputComponentId, outputProp, getState, requestUid, dispatch, changedPropIds) {
var _getState3 = getState(),
config = _getState3.config,
layout = _getState3.layout,
Expand All @@ -34041,7 +34043,8 @@ function updateOutput(outputComponentId, outputProp, getState, requestUid, dispa
*/

var payload = {
output: { id: outputComponentId, property: outputProp }
output: { id: outputComponentId, property: outputProp },
changedPropIds: changedPropIds
};

var _dependenciesRequest$ = dependenciesRequest.content.find(function (dependency) {
Expand All @@ -34065,6 +34068,14 @@ function updateOutput(outputComponentId, outputProp, getState, requestUid, dispa
};
});

var inputsPropIds = inputs.map(function (p) {
return p.id + '.' + p.property;
});

payload.changedPropIds = changedPropIds.filter(function (p) {
return (0, _ramda.contains)(p, inputsPropIds);
});

if (state.length > 0) {
payload.state = state.map(function (stateObject) {
// Make sure the component id exists in the layout
Expand Down Expand Up @@ -34288,7 +34299,7 @@ function updateOutput(outputComponentId, outputProp, getState, requestUid, dispa
uid: requestUid,
requestTime: Date.now()
}, getState().requestQueue)));
updateOutput(idAndProp.split('.')[0], idAndProp.split('.')[1], getState, requestUid, dispatch);
updateOutput(idAndProp.split('.')[0], idAndProp.split('.')[1], getState, requestUid, dispatch, changedPropIds);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion dash_renderer/dash_renderer.dev.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_renderer/dash_renderer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_renderer/dash_renderer.min.js.map

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ export function notifyObservers(payload) {
outputProp,
getState,
requestUid,
dispatch
dispatch,
changedProps.map(prop => `${id}.${prop}`)
)
);
}
Expand All @@ -356,7 +357,8 @@ function updateOutput(
outputProp,
getState,
requestUid,
dispatch
dispatch,
changedPropIds,
) {
const {config, layout, graphs, paths, dependenciesRequest} = getState();
const {InputGraph} = graphs;
Expand All @@ -371,6 +373,7 @@ function updateOutput(
*/
const payload = {
output: {id: outputComponentId, property: outputProp},
changedPropIds
};

const {inputs, state} = dependenciesRequest.content.find(
Expand Down Expand Up @@ -406,6 +409,12 @@ function updateOutput(
};
});

const inputsPropIds = inputs.map(p => `${p.id}.${p.property}`);

payload.changedPropIds = changedPropIds.filter(
p => contains(p, inputsPropIds)
);

if (state.length > 0) {
payload.state = state.map(stateObject => {
// Make sure the component id exists in the layout
Expand Down Expand Up @@ -703,7 +712,8 @@ function updateOutput(
idAndProp.split('.')[1],
getState,
requestUid,
dispatch
dispatch,
changedPropIds
);
});
}
Expand Down