Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sources.forEach((proxy) => {
commit(Mutations.PROXY_SOURCE_TO_REPRESENTATION_SET, proxy);
// Fetch proxy data if not available
if (!state.proxyDataMap[proxy.id]) {
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.id });
}
// Fetch proxy name if not available
if (!state.proxyNames[proxy.id]) {
dispatch(Actions.PROXY_NAME_FETCH, proxy.id);
}
// Fetch representation data if not available
if (!state.proxyDataMap[proxy.rep]) {
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.rep });
}
// Fetch representation name if not available
if (!state.proxyNames[proxy.rep]) {
dispatch(Actions.PROXY_NAME_FETCH, proxy.rep);
}
});
function apply() {
if (this.create) {
return;
}
if (this.isNetworkBusy && !scheduledApply) {
scheduledApply = setTimeout(() => {
scheduledApply = null;
apply.apply(this);
}, 100);
}
if (this.isNetworkBusy < 3 && hasChange()) {
// console.log('apply', JSON.stringify(changeSet, null, 2));
store.dispatch(Actions.PROXY_UPDATE, changeSet);
store.dispatch(Actions.PROXY_DATA_FETCH, {
proxyId: this[`active${proxyType}Id`],
needUI: false,
});
}
}
.then(() => {
dispatch(Actions.PROXY_DATA_FETCH, {
proxyId: representationId,
needUI: false,
});
})
.catch(console.error);