Fix reduce no zero index bug

This commit is contained in:
Ilya Ig. Petrov 2017-06-01 16:02:50 +05:00
parent 5a1f788247
commit 82c155f662
4 changed files with 12 additions and 13 deletions

View File

@ -123,9 +123,10 @@
const conf = configs[key];
if(typeof(conf.order) === 'number') {
if(!category || category === (conf.category || 'general')) {
arr.push(conf);
conf.value = pacMods[key];
conf.key = key;
conf.category = category || 'general';
arr.push(conf);
}
}
return arr;
@ -433,15 +434,12 @@ ${ pacMods.filteredCustomsString
const oldProxies = getCurrentConfigs().filteredCustomsString || '';
const newProxies = pacMods.filteredCustomsString || '';
ifProxiesChanged = oldProxies !== newProxies;
console.log('Proxies changed from:', oldProxies, 'to', newProxies);
kitchenState(modsKey, pacMods);
}
console.log('Keep cooked now...', pacMods);
this.setNowAsync(
(err, res, ...setWarns) => {
const accWarns = modsWarns.concat(setWarns); // Acc = accumulated.
console.log('Try now err:', err);
if (err) {
return cb(err, res, ...accWarns);
}

View File

@ -25,6 +25,11 @@ export default function getApp(theState) {
hashParams: hashParams,
};
this.setStatusTo = this.setStatusTo.bind(this);
this.conduct = this.conduct.bind(this);
this.showErrors = this.showErrors.bind(this);
this.showNews = this.showNews.bind(this);
}
setStatusTo(msg, cb) {
@ -75,7 +80,6 @@ export default function getApp(theState) {
};
const ghUrl = `https://api.github.com/repos/edge-ware/edge-ware.github.io/issues/1/comments${query}`;
console.log(ghUrl);
const [comments, etag] = await fetch(
ghUrl,
params
@ -248,10 +252,10 @@ export default function getApp(theState) {
console.log('Render');
const props = Object.assign({}, originalProps, {
funs: {
setStatusTo: this.setStatusTo.bind(this),
conduct: this.conduct.bind(this),
showErrors: this.showErrors.bind(this),
showNews: this.showNews.bind(this),
setStatusTo: this.setStatusTo,
conduct: this.conduct,
showErrors: this.showErrors,
showNews: this.showNews,
},
ifInputsDisabled: this.state.ifInputsDisabled,
hashParams: this.state.hashParams,

View File

@ -55,7 +55,7 @@ export default function getMain(theState) {
modsMutated[conf.key] = conf.value;
return modsMutated;
});
}, modsMutated/*< Needed for index 0*/);
that.props.funs.conduct(
'Применяем настройки...',
(cb) => that.props.apis.pacKitchen.keepCookedNowAsync(newMods, cb),
@ -67,7 +67,6 @@ export default function getMain(theState) {
handleModChange({targetConf, targetIndex, newValue}) {
console.log('NEW VALUE', newValue);
const oldCats = this.state.catToOrderedMods;
const newCats = Object.keys(this.state.catToOrderedMods).reduce((acc, cat) => {

View File

@ -207,7 +207,6 @@ export default function getProxyEditor(theState) {
handleAdd(that, event) {
console.log('handle add');
const form = event.target;
const elements = Array.from(form.elements).reduce((acc, el, index) => {
@ -222,7 +221,6 @@ export default function getProxyEditor(theState) {
const newValue = `${that.props.proxyStringRaw}; ${type} ${hostname}:${port}`
.trim().replace(/(\s*;\s*)+/, '; ');
console.log('NEW VALUE', newValue);
that.props.setProxyStringRaw(newValue);
}