After the last review, several sites are experiencing issues when saving posts.
They describe that when they remove an author from the list and save, the original author is added back to the post.
I noticed that the subscribe callback is triggering multiple ajax requests to save the post. I fixed it by putting the subscribe call outside the component, and thus running it only once. This is how things were done before. It seems to solve the issue.
Description
After the last review, several sites are experiencing issues when saving posts.
They describe that when they remove an author from the list and save, the original author is added back to the post.
I noticed that the
subscribe
callback is triggering multiple ajax requests to save the post. I fixed it by putting thesubscribe
call outside the component, and thus running it only once. This is how things were done before. It seems to solve the issue.Context: In https://github.com/Automattic/Co-Authors-Plus/pull/870 the
subscribe
was removed and the changes were saved instantly. https://github.com/Automattic/Co-Authors-Plus/pull/914 reintroduced thesubscribe
behavior.There are other issues though, that were not introduced by the latest changes, which this PR does not fix.
These 2 bugs are not new and should be addressed in other PRs
Deploy Notes
None
Steps to Test
On
master
coauthors/v1/authors/{$POST_ID}?new_authors={$AUTHORS_NICENAMES}&_locale=user
Apply this branch and do the same.