-
Notifications
You must be signed in to change notification settings - Fork 5
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 handling of the universalLimit
in verticalsToConfig
.
#1021
Conversation
.filter(([key, _]) => key != 'index') | ||
.reduce((limit, [_, config]) => { | ||
const verticalKey = config.verticalKey; | ||
const hasUniversalLimit = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the following code might be slightly simpler if this is just const universalLimit = ...
but also feels like a personal preference thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I had something like that initially.
const universalLimit = blah?.blah?.universalLimit
But somehow that syntax routinely caused our Percy snapshot generator to crash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah I don't think optional chaining is supported for all the node versions we support. I was just thinking we coudl rename hasUniversalLimit
to just universalLimit
and then line 20 doesn't need to repeat pageConfig.verticalsToConfig[verticalKey].universalLimit
### Features - Consumer Authentication support was added for the Sandbox environment. (#996) - The existing `image` formatter was updated to support photos sent from the Streams API. (#998) - Support for Direct Answers on Vertical was added to the `vertical-standard` template. It is commented out by default. (#994) ### Changes - To better support Consumer Authentication, the `AnswersExperience.init()` method can be called on `Document` load. (#995) - The default `universalLimit` for all Vertical page configs was updated to 4. (#1010, #1021) ### Bugfixes - Ensured that in all page templates, the `SpellCheck` appears above the `ResultsCount`. (#1011, #1017) - In the `highlightedField` formatter, any HTML tag that appears in the text, that is not `<mark>` or `</mark>`, is now escaped. (#1012) - Font pre-loads on Multi-lang sites now work correctly. (#1018) - A new CSS variable was added: `--yxt-filter-options-option-label-line-height`. This variable, when kept in proper proportion to `--yxt-filters-and-sorts-font-size`, will ensure the scroll bar does not erroneously appear for filter options. (#1015, #1019)
### Features - Consumer Authentication support was added for the Sandbox environment. (#996) - The existing `image` formatter was updated to support photos sent from the Streams API. (#998) - Support for Direct Answers on Vertical was added to the `vertical-standard` template. It is commented out by default. (#994) ### Changes - To better support Consumer Authentication, the `AnswersExperience.init()` method can be called on `Document` load. (#995) - The default `universalLimit` for all Vertical page configs was updated to 4. (#1010, #1021) ### Bugfixes - Ensured that in all page templates, the `SpellCheck` appears above the `ResultsCount`. (#1011, #1017) - In the `highlightedField` formatter, any HTML tag that appears in the text, that is not `<mark>` or `</mark>`, is now escaped. (#1012) - Font pre-loads on Multi-lang sites now work correctly. (#1018) - A new CSS variable was added: `--yxt-filter-options-option-label-line-height`. This variable, when kept in proper proportion to `--yxt-filters-and-sorts-font-size`, will ensure the scroll bar does not erroneously appear for filter options. (#1015, #1019)
Previously, if a
universalLimit
were specified for a vertical, we would perform client-side filtering. Instead, we should be creating asearch.universalLimit
object and passing that toANSWERS.init
. Not only does this remove responsibility from the front-end, but it allows the HH to display more than 10 results per vertical on the Universal page.This PR adds a
getDefaultUniversalLimit
helper that iterates through the vertical page configs and uses theverticalsToConfig.universalLimits
to build asearch.universalLimit
.J=SLAP-1749
TEST=manual
Tested the following scenarios and verified correct behavior in each:
universalLimit
values are set and there is no limit specified in theglobal_config
orpageSettings
.universalLimit
values are set, but not others. There is no universal limit in theglobal_config
orpageSettings
.universalLimit
values are set, but a universal limit is also present in theglobal_config
.