Correct domain replacement for GraphQL fields #650
Merged
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.
Resolves #541
As mentioned in #541, it appeared we were not doing domain replacement on menu item URLs. Upon investigation, it appears we are performing replacements that should cover menu item URLs, but these replacements were short-circuited by the presence of
generalSettings
in the response data. I believe the intention here was to skip replacements inside ofgeneralSettings
, as queries forgeneralSettings.url
should accurately report the URL of the WordPress instance rather than the front-end application.With the way GQty assembles queries, it's likely
generalSettings
will be included in most requests. This PR changes the replacement callback to skipgeneralSettings
without preventing replacements elsewhere in the response data.Testing
Manual Testing
url
fields receive domain replacementsgeneralSettings.url
is unchanged, but all menu item urls have been rewritten: