Skip to content
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

Merged
merged 5 commits into from
Dec 13, 2021

Conversation

tmeyer2115
Copy link
Collaborator

Previously, if a universalLimit were specified for a vertical, we would perform client-side filtering. Instead, we should be creating a search.universalLimit object and passing that to ANSWERS.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 the verticalsToConfig.universalLimits to build a search.universalLimit.

J=SLAP-1749
TEST=manual

Tested the following scenarios and verified correct behavior in each:

  • No universalLimit values are set and there is no limit specified in the global_config or pageSettings.
  • Some universalLimit values are set, but not others. There is no universal limit in the global_config or pageSettings.
  • Some universalLimit values are set, but a universal limit is also present in the global_config.

@coveralls
Copy link

coveralls commented Dec 13, 2021

Coverage Status

Coverage decreased (-0.01%) to 8.842% when pulling 9da8f3a on dev/universal-limit into 6b0e550 on release/v1.27.

@tmeyer2115 tmeyer2115 changed the base branch from develop to release/v1.27 December 13, 2021 19:30
hbshelpers/getDefaultUniversalLimit.js Outdated Show resolved Hide resolved
.filter(([key, _]) => key != 'index')
.reduce((limit, [_, config]) => {
const verticalKey = config.verticalKey;
const hasUniversalLimit =
Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Contributor

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

hbshelpers/getDefaultUniversalLimit.js Show resolved Hide resolved
@tmeyer2115 tmeyer2115 merged commit e958b68 into release/v1.27 Dec 13, 2021
@tmeyer2115 tmeyer2115 mentioned this pull request Dec 14, 2021
tmeyer2115 added a commit that referenced this pull request Dec 14, 2021
### 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)
@tmeyer2115 tmeyer2115 mentioned this pull request Jan 11, 2022
tmeyer2115 added a commit that referenced this pull request Jan 11, 2022
### 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants