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

Commit

Permalink
🔨 Filter changed props that are not connected to the inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Feb 14, 2019
1 parent 8136212 commit e6a2158
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
14 changes: 11 additions & 3 deletions dash_renderer/dash_renderer.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -34023,7 +34023,7 @@ function notifyObservers(payload) {
};
}

function updateOutput(outputComponentId, outputProp, getState, requestUid, dispatch, changedProps) {
function updateOutput(outputComponentId, outputProp, getState, requestUid, dispatch, changedPropIds) {
var _getState3 = getState(),
config = _getState3.config,
layout = _getState3.layout,
Expand All @@ -34044,7 +34044,7 @@ function updateOutput(outputComponentId, outputProp, getState, requestUid, dispa

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

var _dependenciesRequest$ = dependenciesRequest.content.find(function (dependency) {
Expand All @@ -34068,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 @@ -34291,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.

13 changes: 10 additions & 3 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function updateOutput(
getState,
requestUid,
dispatch,
changedProps,
changedPropIds,
) {
const {config, layout, graphs, paths, dependenciesRequest} = getState();
const {InputGraph} = graphs;
Expand All @@ -373,7 +373,7 @@ function updateOutput(
*/
const payload = {
output: {id: outputComponentId, property: outputProp},
changedProps
changedPropIds
};

const {inputs, state} = dependenciesRequest.content.find(
Expand Down Expand Up @@ -409,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 @@ -706,7 +712,8 @@ function updateOutput(
idAndProp.split('.')[1],
getState,
requestUid,
dispatch
dispatch,
changedPropIds
);
});
}
Expand Down

0 comments on commit e6a2158

Please sign in to comment.