When getting content for a post, ensure we're always getting the most recent version#367
Conversation
…riggered so we are working with the latest version of the content
… triggered so we are working with the latest version of the content
…erating a featured image, grab that context directly from the post so we know we're getting the most recent version of the title
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #367 +/- ##
==========================================
Coverage 58.09% 58.09%
Complexity 630 630
==========================================
Files 46 46
Lines 3193 3193
==========================================
Hits 1855 1855
Misses 1338 1338
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What?
When content about a post is needed when an experiment is triggered, ensure we always grab the most recent version.
Why?
There was a bug report around the Title Generation Experiment and how they added some post content that was about one topic and then changed that content to be about a completely different topic. When generating titles, the titles reflected the first content, not the second.
The issue here is we grab the content from the editor at page load so if the content is changed and the page isn't refreshed, we have the old version of the content stored. Instead we should pull the content fresh each time title generation is triggered.
I audited all of our other Experiments and found similar problems with Excerpt Generation and Featured Image Generation (in particular, generating the image prompt). All of those are fixed now. All other Experiments were working correctly.
How?
useSelecthook to get the post content and excerpt when Excerpt Generation is triggered to ensure we always have the freshest dataget-post-detailsAbility and instead directly grab the post title and post type. This ensures we always have the most up-to-date title instead of the latest version stored in the databaseUse of AI Tools
None
Testing Instructions
npm i && npm run build