Skip to content
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

Clicking preview multiple times causes the autosave revision to be created and deleted repeatedly. #20505

Closed
Inwerpsel opened this issue Feb 27, 2020 · 4 comments
Labels
[Feature] Saving Related to saving functionality [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed.

Comments

@Inwerpsel
Copy link

Describe the bug
Click the preview button multiple times in a row, without making any changes to the post in between. This will result with the autosave revision being created and destroyed repeatedly (check the response of the api request that does the autosave, it alternates between 200 and 400).

To reproduce
Steps to reproduce the behavior:

  1. On any post, save it and don't make any changes after that
  2. Click on the preview button.
  3. Notice the browser sends a request to /wp-json/wp/v2/post_type/{id}/autosaves that gets a 200 response code.
  4. Click on the preview button again.
  5. Notice the same requests as above is sent, however now this requests gets a 400 response code.
  6. You can now repeat steps 2 to 5 indefinitely and the response code will keep on alternating between the two.
  7. Check the database between the steps and notice how a record in the wp_posts table keeps being created and deleted, each time bumping the ids of the table.

Expected behavior
Clicking the preview button multiple times without any changes to the post should not create a record more than once.

Perhaps this is something that should be fully tackled on the backend side, however maybe a solution/mitigation in the gutenberg editor is possible here? For example the editor could not send the request in the first place when pressing the preview button consecutively.

Additional context

@annezazu
Copy link
Contributor

annezazu commented Feb 3, 2021

@Inwerpsel is this still an issue? I ask after seeing your PR merged: greenpeace/planet4-master-theme#1026 I tried to replicate but wasn't able to with Gutenberg 9.8.3.

@annezazu annezazu added the [Status] Needs More Info Follow-up required in order to be actionable. label Feb 3, 2021
@ZebulanStanphill ZebulanStanphill changed the title Clicking review multiple times causes the autosave revision to be created and deleted repeatedly. Clicking preview multiple times causes the autosave revision to be created and deleted repeatedly. Feb 4, 2021
@github-actions
Copy link

Help us move this issue forward. Since it has no activity after 15 days of requesting more information, a bot is marking the issue as stale. Please add additional information as a comment or this issued will be closed in 5 days.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Feb 20, 2021
@Inwerpsel
Copy link
Author

Inwerpsel commented Feb 22, 2021

@Inwerpsel is this still an issue? I ask after seeing your PR merged: greenpeace/planet4-master-theme#1026 I tried to replicate but wasn't able to with Gutenberg 9.8.3.

We didn't have the issue anymore after the workaround we did (which so far has worked well for us). I have to catch up again with the issue, will let you know more soon. Probably it's indeed fixed by changes to autosaving and/or previewing that happened in the meanwhile.

@annezazu
Copy link
Contributor

Thanks @Inwerpsel! I'm going to close this out for now but please feel free to re-open if the problem recurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Saving Related to saving functionality [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed.
Projects
None yet
Development

No branches or pull requests

3 participants