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

FSE: Modified Template Part block attributes trigger a blank revision in the page editor #34751

Closed
apeatling opened this issue Jul 18, 2019 · 4 comments
Assignees
Labels
[Goal] Full Site Editing [Type] Bug When a feature is broken and / or not performing as intended

Comments

@apeatling
Copy link
Member

apeatling commented Jul 18, 2019

I am seeing this notice on my home page in the editor almost 100% of the time:

Screen Shot 2019-07-18 at 10 43 35 AM

When I look at the revision it wants to restore I'm seeing this blank revision:

Screen Shot 2019-07-18 at 10 45 18 AM

We should investigate this and make sure it's not a bug. It's possible I am not saving the home page enough, since I've mainly been editing the header template part content. However, seeing a blank revision gives me pause, that shouldn't happen.

@apeatling apeatling added [Type] Bug When a feature is broken and / or not performing as intended [Goal] Full Site Editing labels Jul 18, 2019
@noahtallen noahtallen self-assigned this Jul 31, 2019
@noahtallen
Copy link
Contributor

noahtallen commented Jul 31, 2019

So I'm really digging into this to see if I can ever get a blank revision. Unfortunately, not yet! I think I know why we get the message almost 100% of the time, though.

Two conditions have to both be true to get into the loop:

  1. You click "leave" after it tells you you have unsaved changes.
  2. When you click leave, it had recently done an autosave of those unsaved changes.

To reproduce:

  1. Open a page, and just click into the placeholder where it says "start writing or type / to choose a block":
    Screen Shot 2019-07-31 at 11 28 54 AM That inserts a new paragraph block even if you don't type anything
  2. Wait for one minute. At the one minute mark, it should trigger an autosave.
  3. Click the back button OR "edit header" (either one will take you away from the page)
  4. It will prompt you that you have unsaved changes to see if you want to leave anyways. Click "leave" without saving or publishing or anything like that.
  5. Immediately go back to the page and you'll see the autosave revision message. With just clicking into the placeholder, I get the smallest revision I can reproduce so far:

Screen Shot 2019-07-31 at 11 31 40 AM

Every time you go back to the page, it will tell you about the autosave revision until you manually "update" or "publish" or "save" the post.

I know that I click leave without saving all the time while I'm debugging these pages, and since we navigate around so much while debugging without updating or publishing, we get the message all the time.

While that isn't truly a bug (it's working as designed), I think it just highlights how poor the autosave flow is. My intuition would be that it always restores the latest autosave when going back to the page in the spirit of always having your latest changes, just like all our modern, realtime apps (i.e. google docs) always have your latest changes. That's pretty far out of the scope of this issue, though!

@noahtallen
Copy link
Contributor

I wonder if the blank revision could be an edge case where gutenberg (or whatever mechanism) falsely thinks the post is dirty, so the autosave happens, but there aren't any changes to compare in the diff. No clue what that edge case would be though. I'm also trying to modify things like block attributes to see if that would trigger something like that.

@noahtallen
Copy link
Contributor

noahtallen commented Jul 31, 2019

Yay, I was able to trigger a blank revision! You can do it by:

  1. Open a page with FSE enabled
  2. Select the header template part block. In the sidebar, add an anchor and hit enter:

Screen Shot 2019-07-31 at 12 02 41 PM

  1. Open the sidebar again to make sure the anchor is still there
  2. Wait at least one minute for the autosave Note, make sure you didn't make any changes other than the anchor
  3. Navigate away from the page (and click "leave" when it warns you of unsaved changes)
  4. Go back into the page and see the revision notice.
  5. Click the link to see the revision. It will be blank.

Restoring the autosave does not restore your unfortunate anchor tag :(

@noahtallen noahtallen changed the title FSE: Autosaves are triggering blank revisions FSE: Modified Template Part block attributes trigger a blank revision in the page editor Jul 31, 2019
@noahtallen
Copy link
Contributor

It should no longer be possible to reproduce this, but feel free to reopen if you notice it again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Full Site Editing [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

2 participants