Skip to content

Commit

Permalink
sq
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaiir committed Dec 11, 2023
1 parent 7209e13 commit 25786bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class UpdateKeyClaimHandler {
const valuePath = this._pathRegistry.getValuePath(formField, options);

if (claiming) {
this._pathRegistry.claimPath(valuePath, { isClosed: true });
this._pathRegistry.claimPath(valuePath, { isClosed: true, claimerId: formField.id });
} else {
this._pathRegistry.unclaimPath(valuePath);
}
Expand All @@ -36,13 +36,14 @@ export default class UpdateKeyClaimHandler {
revert(context) {
const {
claiming,
formField,
valuePath
} = context;

if (claiming) {
this._pathRegistry.unclaimPath(valuePath);
} else {
this._pathRegistry.claimPath(valuePath, { isClosed: true });
this._pathRegistry.claimPath(valuePath, { isClosed: true, claimerId: formField.id });
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function Key(props) {
// unclaim temporarily to avoid self-conflicts
pathRegistry.unclaimPath(oldPath);
const canClaim = pathRegistry.canClaimPath(newPath, { isClosed: true, claimerId: field.id });
pathRegistry.claimPath(oldPath, { isClosed: true });
pathRegistry.claimPath(oldPath, { isClosed: true, claimerId: field.id });

return canClaim ? null : 'Must not conflict with other key/path assignments.';
};
Expand Down
7 changes: 6 additions & 1 deletion packages/form-js-viewer/src/core/PathRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,17 @@ export default class PathRegistry {
result = result && callResult;
}

// stop executing if false is specifically returned
if (result === false) {
return result;
}

if (Array.isArray(field.components)) {
for (const child of field.components) {
const callResult = this.executeRecursivelyOnFields(child, fn, clone(context));
result = result && callResult;

// only stop executing if false is specifically returned, not if undefined
// stop executing if false is specifically returned
if (result === false) {
return result;
}
Expand Down

0 comments on commit 25786bb

Please sign in to comment.