diff --git a/packages/nova-forms/lib/withEdit.jsx b/packages/nova-forms/lib/withEdit.jsx
index eaedd8734..fa726d7b2 100644
--- a/packages/nova-forms/lib/withEdit.jsx
+++ b/packages/nova-forms/lib/withEdit.jsx
@@ -13,14 +13,15 @@ export default function withEdit(WrappedComponent, options) {
}
render() {
- const { mutationName, fragment, resultQuery, collection } = this.props
- // if the mutation given to NovaForm isn't about editing an existing document, do nothing
- if (mutationName.indexOf('Edit') === -1) {
+ // if the NovaForm mutation isn't about editing an existing document (it doesn't have one), do nothing
+ if (!this.props.document) {
return
} else {
+
+ const { mutationName, fragment, resultQuery, collection } = this.props;
const collectionName = collection._name;
diff --git a/packages/nova-forms/lib/withNew.jsx b/packages/nova-forms/lib/withNew.jsx
index 483e888b5..1cdac8eb3 100644
--- a/packages/nova-forms/lib/withNew.jsx
+++ b/packages/nova-forms/lib/withNew.jsx
@@ -12,15 +12,16 @@ export default function withNew(WrappedComponent, options) {
}
render() {
- const { mutationName, fragment, resultQuery, collection } = this.props
- // if the mutation given to NovaForm isn't about creating a new document, do nothing
- if (mutationName.indexOf('New') === -1) {
+ // if the NovaForm mutation isn't about creating a new document (it already has one), do nothing
+ if (this.props.document) {
return
} else {
+ const { mutationName, fragment, resultQuery, collection } = this.props;
+
const collectionName = collection._name;
const ComponentWithMutation = graphql(gql`
diff --git a/packages/nova-lib/lib/mutations.js b/packages/nova-lib/lib/mutations.js
index 0c2610c94..1f11cc7e9 100644
--- a/packages/nova-lib/lib/mutations.js
+++ b/packages/nova-lib/lib/mutations.js
@@ -131,7 +131,7 @@ const editMutation = ({ action, collection, documentId, set, unset, currentUser,
collection.simpleSchema().namedContext(`${collectionName}.edit`).validate(modifier, {modifier: true});
// run validation callbacks
- document = Telescope.callbacks.run(`${collectionName}.edit.validate`, modifier, document, currentUser);
+ modifier = Telescope.callbacks.run(`${collectionName}.edit.validate`, modifier, document, currentUser);
}
// run sync callbacks (on mongo modifier)