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

Autosave: Also save tags and categories #12472

Closed
Copons opened this issue Nov 30, 2018 · 3 comments
Closed

Autosave: Also save tags and categories #12472

Copons opened this issue Nov 30, 2018 · 3 comments
Labels
[Feature] History History, undo, redo, revisions, autosave. Needs Decision Needs a decision to be actionable or relevant [Type] Enhancement A suggestion for improvement.

Comments

@Copons
Copy link
Contributor

Copons commented Nov 30, 2018

Related to Automattic/wp-calypso#28771

Context

The original issue reported this:

  • Create a new post.
  • Add some categories and tags.
  • Modify title or content to trigger the autosave.
  • Wait for the autosave to complete.
  • Open the preview of the post.
  • The preview doesn't contain the categories and tags we set earlier.

The reason is that the autosave doesn't save categories and tags.

Although, in our initial investigation, this issue only occurred on WP.com, but didn't on WP.org.
It took me a while to figure why.

PostPreviewButton under certain conditions performs a full save when opening the Preview:

// If we don't need to autosave the post before previewing, then we simply
// load the Preview URL in the Preview tab.
if ( ! this.props.isAutosaveable ) {
this.setPreviewWindowLink( event.target.href );
return;
}
// Request an autosave. This happens asynchronously and causes the component
// to update when finished.
if ( this.props.isDraft ) {
this.props.savePost( { isPreview: true } );
} else {
this.props.autosave( { isPreview: true } );
}

On my WP.com site, isAutosaveable was always false, and therefore the button early-returned before performing the save.
On the WP.org one, instead, it was always true.

This is because of the forceIsAutosaveable prop, set from the parent component:

<PostPreviewButton
forceIsAutosaveable={ hasActiveMetaboxes }
forcePreviewLink={ isSaving ? null : undefined }
/>

And now it became obvious: my WP.org site has meta boxes, while my WP.com one doesn't.

Doubts and Questions

At first I wanted to propose to perform a full save on Preview in any case, in order to view the correct category, tags, and possibly many more post attributes.
Though, this would be ill-advised, because we don't really want to stealth-save a published post with changes that might not be final yet.

Then I wondered if it was just enough to drop the isAutosaveable check, and always perform either a full save on drafts, or an autosave on published.
This would solve the issue for drafts, but not at all for published.

So, assuming I'm not the only one bothered by this issue (well, me and Calypso e2e tests 😄), I'm wondering if it could make sense to extend autosave to also save categories, tags, and possibly other post attributes that might be very obviously missing from the preview.

@designsimply
Copy link
Member

Noting that #7767 sounds similar and was marked as invalid. For me, it would be nice to clarify the expected behaviors around autosaves and previews for both drafts and published posts:

  1. Should an autosave of a draft also save all meta data? (Autosaved preview does not show featured images, categories, or tags #7767)
  2. Clicking Preview for a draft should save all post details, including meta (resolved in Perform a full save when previewing drafts #12047).
  3. What should happen to the meta data for an autosave of a modified published post?
  4. What should happen to the meta data when Preview is clicked for a modified published post?
  5. What is "all meta data"? (title, categories, tags, featured images, custom fields, third-party meta box content?)

Related:

@designsimply designsimply added [Type] Question Questions about the design or development of the editor. and removed [Type] Enhancement A suggestion for improvement. labels Nov 30, 2018
@designsimply
Copy link
Member

cc @adamsilverstein @youknowriad

@alisterscott alisterscott added the [Feature] History History, undo, redo, revisions, autosave. label Dec 3, 2018
@adamsilverstein adamsilverstein pinned this issue Dec 18, 2018
@noisysocks noisysocks unpinned this issue Dec 18, 2018
@talldan talldan added [Type] Enhancement A suggestion for improvement. Needs Decision Needs a decision to be actionable or relevant and removed [Type] Question Questions about the design or development of the editor. labels Apr 23, 2020
@paaljoachim
Copy link
Contributor

I just tested with Twenty Twenty One theme.
WordPress 5.7 beta version.
On the WordPress Beta Tester plugin is activated.

Followed the testing procedure as mentioned by @Copons

Create a new post.
Add some categories and tags.
Modify title or content to trigger the autosave.
Wait for the autosave to complete.
Open the preview of the post.
The preview doesn't contain the categories and tags we set earlier.

The preview shows categories and tags that I set.
The following screenshot is a preview based only on Autosave function.

Screen Shot 2021-02-08 at 20 32 17

It shows the category Books and News. The tags In the sun, Night and Weather.
These were added to the post.

Based on my findings I will go ahead and close this issue. @Copons or anyone else please reopen if there are other concerns that I have missed. I do believe all the issues/PR's @designsimply linked to have either been closed or merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] History History, undo, redo, revisions, autosave. Needs Decision Needs a decision to be actionable or relevant [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants