make entity selection cycle in wizards behave nicely

This commit is contained in:
Val Erastov 2018-12-10 23:31:11 -08:00
parent bb0705221f
commit 7d7a701ec4

View file

@ -63,15 +63,15 @@ function createPickHandlerFromSchema(wizCtx) {
function select(param, entity, md, id) {
const updater = md.type === 'array' ? arrayUpdater : singleUpdater;
let paramToMakeActive = getNextActiveParam(param, md);
let paramToMakeActive = getNextActiveParam(param, entity, md);
update(params => {
updater(params, param, id);
}, paramToMakeActive);
}
function getNextActiveParam(currParam, currMd) {
function getNextActiveParam(currParam, entity, currMd) {
if (currMd.type !== 'array') {
let entityGroup = entitiesByType[activeEntity];
let entityGroup = entitiesByType[entity];
if (entityGroup) {
const index = entityGroup.indexOf(currParam);
const nextIndex = (index + 1) % entityGroup.length;