Conversation
… they're tracked for things like preview support, but also to prevent duplicate registration. - ensure field types that return a connection are tracked in the registry. This fixes a bug related to previews not resolving, and likely also prevents duplicate registration of some fields in some cases.
3 tasks
Pull Request Test Coverage Report for Build 046b302be979fdbff9d14a546b3ee38b1f51ab2b-PR-189Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
…inst previews - update TextFieldTest.php to test querying against a preview
…1 as the published image, 1 as the preview image, for example) - update ImageFieldTest to test querying the image field on a post and querying the image field on a preview
…ow the Image Preview Test failing now
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
This fixes a bug where Image fields (and other fields that return Connections) were not properly resolving when querying a page
asPreview: true.In order to support preview resolution, all field names and keys are tracked and then during resolution filters are applied to ensure the meta is resolved properly for each field (either the published post or the preview post).
Fields that return Connection types were not properly being tracked in this registry, leading to the preview resolver filter not being applied for these fields, so they would return preview data from the published node instead of the preview node.
Does this close any currently open issues?
closes #187
Any other comments?
I published a page with the following image uploaded for the image fields:
http://uri-debugging.local/wp-content/uploads/2024/03/1920x1080.pngWhen I query the page with
asPreview: falseI see the image returned as expected:When I query the page as an authenticated user with
asPreview: true, I see the published image value (expected, since I have not made any un-published changes yet):Now, if I go replace the image:
http://uri-debugging.local/wp-content/uploads/2024/03/1920x1080.pnghttp://uri-debugging.local/wp-content/uploads/2024/03/andrea-de-santis-kq3hRVDiYYY-unsplash-scaled.jpgAnd query
asPreview: trueagain:BEFORE
I still see the published image, not the preview image. 😭
AFTER
I see the image that was added to the preview but not yet published! 🥳