Skip to content

Commit

Permalink
fix: bug where field hooks and access control couuld potentially compete
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikrut committed Oct 21, 2021
1 parent badbdca commit c35009f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/fields/accessPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ const accessPromise = async ({
if (field.access && field.access[accessOperation]) {
const result = overrideAccess ? true : await field.access[accessOperation]({ req, id, siblingData: data, data: fullData });

if (!result && accessOperation === 'update' && originalDoc[field.name] !== undefined) {
resultingData[field.name] = originalDoc[field.name];
} else if (!result) {
if (!result) {
delete resultingData[field.name];
}
}
Expand Down

0 comments on commit c35009f

Please sign in to comment.