Wp-calypso: Gutenberg: Removing all tags at once fails on simple sites

Created on 22 Nov 2018  路  23Comments  路  Source: Automattic/wp-calypso

Steps to reproduce

  1. Make sure you use the block editor for all of the post editing:
  2. Starting at URL: https://wordpress.com/posts
  3. Add a new post or edit an exiting post
  4. Add one or more tags
  5. Save draft or publish post
  6. Edit post and remove all tags
  7. Save draft or update post

What I expected

I would expect that the tags I removed would no longer be present.

What happened instead

All of the tags we just removed repopulate into the tag field as soon as the save/update finishes.

See more context on the cause here: paYE8P-5v-p2

Notes

  • I could only reproduce this on my simple test site in the block editor. Removing all tags worked fine on my Atomic test site and on my local wp install in the block editor.
  • Removing tags works fine in the classic editor on my simple site.
  • It only fails if you try to remove all tags at once. If you have 5 tags and remove 4 of them, that works.
  • If you have 5 tags, remove all of them, and then add one back, that also seems to work.
  • But removing them all at once means that all of them stick around.
  • For example, if there is only one tag (i.e. featured) and you remove it, that featured tag will stick around.
Calypsoify [Goal] Gutenberg [Pri] Normal [Type] Bug

Most helpful comment

The fix for this has been released. Just tested one more time on dotcom and everything is working well!

All 23 comments

Confirmed this is still a valid issue with the iframed editor, and is not a core block editor problem.

Another report of this in 11167451-hc. Tag remains after deleting it and updating the post.

Another report of this in 1889939-zen. Tag remains after deleting and updating post. (It was the only tag on the post)

Another report in 11304405-hc

User reported in #11738004-hc

Confirmed in testing - https://cld.wthms.co/Iv6etq

Another report:

1943409-zen

Confirmed myself via testing the user's site.

Another report here:

1961538-zen

  • can also confirm it's exclusive to Gutenberg, as I have deactivated it at my test site and was able to remove the tag.

Another report here:

2003317 ZD

Can confirm it only happens in Gutenberg

3398591-hc

May be related to #32501.

As implied above, a workaround is to use /wp-admin to remove the tag for now.

Another report here: 12649235-hc

Reported here: 2029448-zen.

The user couldn't remove the featured tag (single tag on the post), and I couldn't even remove it from within Gutenberg editor in wp-admin, but I was able to remove the tag via quick edit.

Reported here as well: 7234245-hc

Had to remove from WP-Admin.

Another report in 13745201-hc.

We were able to remove the tag from wp-admin.

Some more notes:

  1. I could only reproduce this on my simple test site. Removing tags worked ok on my Atomic test site.
  2. It only fails if you try to remove all tags at once. If you have 5 tags and remove 4 of them, that works. If you have 5 tags, remove all of them, and then add one back, that also seems to work. But removing them all at once means that all of them stick around.

I closed #32501 in favor of this issue. #28974 is possibly related.

The API request for updating a post on Simple site contains no tags in two conditions:

  1. If there are no tags
  2. If the tags have not changed

For example, if you have 3 tags on a post, but submit an update in which only the text of the post changes, the API request won't contain anything about the tags (since the tags haven't changed). The API probably assumes that the tags haven't changed in every case that it gets a request in which there are no tags. Of course, if you remove all of the tags, the request contains no tags. As a result, the API does not update the post to remove the tags (since it assumes they should remain the same).

That particular approach is different to how the API request works for both Atomic and core sites. In those cases, the request contains no tags in only one condition:

  1. If the tags have not changed.

If all of the tags have been removed, then the API request on Atomic/core has a field tags: [] indicating that the tags have been removed.

It turns out that jQuery.ajax strips out empty arrays before sending the request. See here for some more info. This is caused by the wpcom api proxy v1, which uses jQuery.

Another case reported - can't delete a tag using Gutenburg. Works using Classic editor - either switch to classic, or via classic editor link in wp admin.

9368172-hc

This will be fixed in D30820-code.

The fix for this has been released. Just tested one more time on dotcom and everything is working well!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samouri picture samouri  路  3Comments

aduth picture aduth  路  3Comments

kellychoffman picture kellychoffman  路  3Comments

gedex picture gedex  路  3Comments

ehg picture ehg  路  3Comments