Proper building of query string inside EditingRenderMiddleware #1071
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.
Description / Motivation
I want to override default
resolvePageUrl
and add GET parameter.I use the way described in the official documentation:
https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/override-default-protocols-using-the-editingrendermiddleware-in-next-js-jss-apps.html?utm_medium=rss&utm_source=dev.sitecore.net
Why do I need this parameter: I need to indicate to some components that the request came from EE/Horizon.
When I add only
someMyKey=${myKeyValue}
it doesn't work because of adding?timestamp=${Date.now()}
. The result string will have 2?
signs, which is not right. I can do some tricks and add?someMyKey=${myKeyValue}&
(with ampersand an at the end). It will give me 2 parameters:someMyKey
and?timestamp
.As
timestamp
parameter is added only to avoid cache, it doesn't matter how it will be named:timestamp
or?timestamp
. It makes this change very minor. But if we can have a proper GET parameter name, why don't have it?Testing Details
yarn install
yarn build
editing-render-middleware.js
Types of changes