Edit Conflict: That post was edited by another user and your changes can no longer be saved

Yes I just got one of these today, @nbianca is going to have a look.

3 Likes

The topic Error message when editing posts is a duplicate of this one.

1 Like

Ok so this is fully fixed with FIX: Update raw and cooked immediate after edit by nbianca · Pull Request #13387 · discourse/discourse · GitHub @nbianca ?

9 Likes

Yes, all known problems are fixed.

8 Likes

Fantastic, thank you!

5 Likes

This is now merged, should be live here in a 20-30 minutes.

10 Likes

Unfortunately this is not yet fixed. My users are still getting the overwrite edits message and I just saw it myself. Running 2.8.0.beta2 ( 0f9d31a85e ).

On another note, when trying to upload the first screenshot to meta.discourse I just got an error

PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "uploads_pkey"

Retrying it worked.

1 Like

I too can still reproduce this here on Meta.

5 Likes

@nbianca this was very hard to isolate but I have a 100% consistent repro.

Make a post with the text:

hello world 123 hello world

Make sure there is a trailing space after the final world word.

Type in world SPACE

Then quickly try to edit your post adding a few letters to the end.

Something about our internal logic is “stripping” trailing and leading spaces and then tripping up the algorithm that detects that a post changed.

10 Likes

I tested this so long, but never thought about adding spaces. I was focused on timing rather than on content.

The PR above will let the server return the raw and use that to update the post record.

14 Likes

I’m impressed you found it, given what it was! So far the fix looks good, thanks again everybody.

1 Like

Sorry, not fixed @nbianca . The exact sequence @sam noted still triggers the bug. Running 2.8.0.beta2 ( 0c42a29dc4 ).

And in fact I just got the error editing this very post on meta.discourse.

Is there anything special you did about this? Did you post and then tried to immediately edit the post or did you wait some time (refresh the page) and then attempted to edit?

Did your post have any whitespaces like before?

1 Like

For testing on my own site, I followed Sam’s instructions. For here, I went to edit in your tag and got the error.

Hmm, I have an easy repro on try.discourse.org … post, then edit and add characters, I get

That post was edited by another user and your changes can no longer be saved.

I’m a little worried about this code path if we’re breaking it so easily and having such trouble fixing it :cry:

6 Likes

I have consistent repro on at least 4 different discourse sites that I’ve updated recently.

Anytime I’d create a new post and immediately try to edit it to fix a typo or to add more text, it’ll start showing a warning in the bottom right of the composer window saying edit conflict with my own profile picture.

When I save the first time, it shows a popup saying the post can’t be saved as it is edited by another user but then it gives me the overwrite button. on clicking which, the post is saved properly.

3 Likes

I have another fix in the works which in my tests resolves the problem when you post something (that usually contains whitespaces in the end) and then you try to quickly edit that.

EDIT: The commit is in tests-passed. Can you please let me know if you still see the problem?

11 Likes

Ok, let’s see if this works

Yes, it works

4 Likes

Seems good so far, but I’ve learned to wait a day before prematurely claiming victory!

Edit: Seems good, for reals this time. Thanks!

5 Likes

This topic was automatically closed after 4 days. New replies are no longer allowed.