webhook / webhook-cms

The CMS layer for Webhook.com
http://www.webhook.com
MIT License
178 stars 41 forks source link

Bug: Cannot delete single relationship from content #249

Open mshick opened 8 years ago

mshick commented 8 years ago

Cross-posting this bug from the forums:

http://forums.webhook.com/t/bug-cannot-delete-single-relationship-from-content/849

Due to this bug I cannot use single-item relationships in the CMS, as they will not be truly modifiable by an end user. The work-around mentioned in that thread does work, but is not acceptable for a non-technical user.

I have a couple of relationship fields in a content type. They are set to "Only allow one searched item and no more." Every time I attempt to delete one of the relationships it is restored. No errors are reporting in the console, no edit locks exist, and the UI refreshes to appear that the relationship is gone, but upon a hard refresh it has returned. Here's the read out from my console:

Validating controls.
vendor.js:31681 -- name: ✓
vendor.js:31681 -- create_date: ✓
vendor.js:31681 -- last_updated: ✓
vendor.js:31681 -- hero_image: ✓
vendor.js:31681 -- hero_book: ✓
vendor.js:31681 -- hero_article: ✓
vendor.js:31681 -- hero_quote: ✓
vendor.js:31681 -- hero_quote_attribution: ✓
vendor.js:31681 -- preview_url: ✓
vendor.js:31681 -- slug: ✓
vendor.js:31681 Updating 2 reverse relationships.
vendor.js:31681 `hero_book` added 0 and removed 1 relationships
vendor.js:31681 `hero_book` wants to remove "homepage homepage" from `books -Jxg3sqqB9gYz3ssmlrS:homepage_hero_book`
vendor.js:31681 `hero_article` added 1 and removed 0 relationships
vendor.js:31681 `hero_article` wants to add "homepage homepage" to `articles -JxgCzi_VfYrxn9CfYx-:homepage_hero_article`
vendor.js:31681 SearchIndex::indexItem::books::The Invaders: A Novel
vendor.js:31681 SearchIndex::indexItem::articles::Bien Cuit, A Delicious Book Release
vendor.js:31681 `hero_book` updated `The Invaders: A Novel:homepage_hero_book` to `[]`.
vendor.js:31681 `hero_article` updated `Bien Cuit, A Delicious Book Release:homepage_hero_article` to `[homepage homepage]`.
vendor.js:31681 Extracting data from 10 controls.
vendor.js:31681 textfield:name
vendor.js:31681 Homepage
vendor.js:31681 datetime:create_date
vendor.js:31681 2015-08-27T18:38:00-04:00
vendor.js:31681 datetime:last_updated
vendor.js:31681 2015-08-28T10:31:00-04:00
vendor.js:31681 image:hero_image
vendor.js:31681 {
  "height": 728,
  "resize_url": "http://lh3.googleusercontent.com/_R-1IPW5pA5bbAWRn1B5kEgI-WJjo06Rjl1f3Gev8qEBCbx0z8c-hOPGd5M4Biyx5cJEVgf4N_u9mHS2ETcU1tMG7yN38g",
  "size": 1264401,
  "type": "image/png",
  "url": "/webhook-uploads/1440715201376/invaders%20home%20hero.png",
  "width": 1326
}
vendor.js:31681 relation:hero_book
vendor.js:31681 undefined
vendor.js:31681 relation:hero_article
vendor.js:31681 articles -JxgCzi_VfYrxn9CfYx-
vendor.js:31681 wysiwyg:hero_quote
vendor.js:31681 undefined
vendor.js:31681 textfield:hero_quote_attribution
vendor.js:31681 undefined
vendor.js:31681 textfield:preview_url
vendor.js:31681 dbb7e258-1c04-93d0-123c-37ce9ce93b92
vendor.js:31681 textfield:slug
vendor.js:31681 undefined
vendor.js:31681 SearchIndex::indexItem::homepage::Homepage
vendor.js:31681 Sending build signal:No publish date.

You can see the update made to hero_book,

`hero_book` updated `The Invaders: A Novel:homepage_hero_book` to `[]`.

So everything seems to have registered properly.

It is also worth noting that if I allow more than one relationship in the field I can delete and empty out the relationships as normal / as you would expect.

Here is a screen recording, showing exactly what happens.

Big blocker on a current project, so hopefully this is an easy fix? Thanks!

kenzik commented 8 years ago

@gpbmike @snide et.all - I can confirm this bug. I've encountered this behavior in the past. If you can't get to it in short order and want to point me in the right direction I can try to get a PR submitted for your review.

@mshick - Your video is a 404.

mshick commented 8 years ago

@dkenzik updated link