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

Fix post preview in Reader mode #4665

Merged
merged 3 commits into from
May 8, 2020
Merged

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented May 7, 2020

Summary

Fixes #4656
Supersedes #4663

This fixes a regression which was introduced in c74ba97 (as part of #3781) when moving to lazy-load properties of AMP_Post_Template. As I recall, switching to load the post data with a getter when accessing post was to avoid keeping a copy of that post around necessarily, as that would introduce a possibility of the copy in AMP_Post_Template becoming out of sync with what is in the DB. Nevertheless, this broke the ability to preview changes to the queried object, which gets populated by the the_preview filter.

This PR reverts part of c74ba97.

Checklist

  • My pull request is addressing an open issue (please create one otherwise).
  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@googlebot googlebot added the cla: yes Signed the Google CLA label May 7, 2020
@westonruter westonruter requested a review from pierlon May 7, 2020 04:47
@ktmn
Copy link

ktmn commented May 7, 2020

Works for me

…preview-reader-mode

* 'develop' of github.com:ampproject/amp-wp:
  Enable SSR by default, remove use of WP_DEBUG as a signal. (#4669)
  Update dependency @wordpress/babel-preset-default to v4.12.1 (#4494)
  Revert "Move .gitattributes file into lib/optimizer folder"
  Move .gitattributes file into lib/optimizer folder
  Remove redundant JSONOBJECT_AS_ARRAY constant
  Use substr() instead of a replacement for removing the leading comment
  Add git attributes file to mark certain file as being generated
  Remove unused import
  Complete stubbed requests data
  Add more tests to assert runtime transformer behavior
  Remove runtime style tag if stylesheet is linked
  Nake use of styles provided via config if available
  Add STYLES configuration key to AmpRuntimeCss transformer
  Adapt spec test to extract configuration arguments from input files
  Update spec files
  Add puppeteer as a peer dependency
  Update dependency @wordpress/block-editor to v3.10.0
  Update dependency xwp/wp-dev-lib to v1.6.3
@westonruter
Copy link
Member Author

I found something that was missed: previewing changes to the title. I've addressed this in 7d81390. Please review.

Copy link
Contributor

@pierlon pierlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that the post title and excerpt are updated when previewed 👍.

@westonruter westonruter merged commit ca87c3b into develop May 8, 2020
@westonruter westonruter deleted the fix/post-preview-reader-mode branch May 8, 2020 02:43
westonruter added a commit that referenced this pull request May 8, 2020
* Fix post preview in Reader mode

* Use post object so that title (and excerpt) can be previewed
westonruter added a commit that referenced this pull request May 13, 2020
…/reader-mode-themes

* 'develop' of github.com:ampproject/amp-wp: (59 commits)
  Strip multiple BOM characters (#4683)
  Strip leading BOM and whitespace and trailing HTML comment before parsing validation response JSON (#4679)
  Update dependency xwp/wp-dev-lib to v1.6.4
  Update dependency eslint to v7
  Remove unused RuntimeException
  Use explicit string type instead of generic array in return
  Avoid method map and replace with a switch
  Defer removal of attributes until after layout application
  Fix post preview in Reader mode (#4665)
  Ensure that source map comment is preserved at the end of amp-custom.css
  Pass DOMAttr instances rather than attribute name and value as separate args
  Enable SSR by default, remove use of WP_DEBUG as a signal. (#4669)
  Use padding-top and override regular inline style for heights
  Update php-parallel-lint dependency to new name
  Use :first-child to reference sizer in CSS
  Update dependency @wordpress/babel-preset-default to v4.12.1 (#4494)
  Fix error type for bad sizes test
  Provide more precise error for thrown exception
  Test precise error messages
  Fix attribute name in error messages
  ...
@pierlon pierlon added this to the v1.5.4 milestone Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preview doesn't work in reader mode on a published post
4 participants