-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
one relation appears many times in beforeChange hook #1353
Comments
Thanks for the bug report 👍 Are you able to share your schema & the hook code so we can reproduce the issue? |
|
the bug appears when you add new field one by one and save after each field is added |
This looks like an issue with the way nested creates are being handled in the Admin UI. A complete reproduction: const { Keystone } = require('@keystone-alpha/keystone');
const { MongooseAdapter } = require('@keystone-alpha/adapter-mongoose');
const { Text, Relationship } = require('@keystone-alpha/fields');
const { GraphQLApp } = require('@keystone-alpha/app-graphql');
const { AdminUIApp } = require('@keystone-alpha/app-admin-ui');
const keystone = new Keystone({
name: 'test-relationship-app',
adapter: new MongooseAdapter(),
});
keystone.createList('Field', {
fields: {
name: { type: Text },
},
});
keystone.createList('Object', {
fields: {
name: { type: Text, isUnique: true },
field: { type: Relationship, ref: 'Field', many: true}
},
hooks: {
beforeChange: ({ resolvedData, existingItem }) => {
console.log('resolvedData',resolvedData)
console.log('existingItem',existingItem)
}
}
});
module.exports = {
keystone,
apps: [
new GraphQLApp(),
new AdminUIApp({ enableDefaultRoute: true }),
],
}; Steps
|
May be related to #1185 |
if you try to delete one of the added items after the first one, the duplicates will multiply. |
This seems fixed in latest release: #1366 |
Confirmed, this is now fixed. Thanks for the report @Olya-Yer! 🎉 |
in before change hook one object is represented several times
in resolved Data
The text was updated successfully, but these errors were encountered: