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

[NO-CI] Update search results loaded event #356

Merged
merged 8 commits into from
Nov 25, 2024

Conversation

esezen
Copy link
Contributor

@esezen esezen commented Nov 20, 2024

No description provided.

@esezen esezen requested a review from a team November 20, 2024 12:46
Copy link
Contributor

@jjl014 jjl014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of changes in this PR, but things are mostly looking good from what I can tell. I did leave some comments around a few failing tests and some things that we may want to keep around. Lmk what you think. Thanks!

It might also be a good idea to get another review of the changes just in case I missed anything. 👍

});

it('Should respond with a valid response when term and required parameters are provided', (done) => {
it('V2 Should respond with a valid response when term and required parameters are provided', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing for me due to the server returning a 400. Getting items[0].item_id must be a string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -1187,7 +1259,6 @@ class Tracker {
numResultsViewed = num_results_viewed,
items,
analyticsTags,
resultCount = result_count || items?.length || 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep some of these changes, like this one, that we added in previously?

} = parameters;
const queryParams = {};
let transformedItems;

if (items && Array.isArray(items) && items.length !== 0) {
const trimmedItems = items.slice(0, 100);

transformedItems = items;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the trimmage?

@@ -657,21 +656,19 @@ class Tracker {
sortBy = sort_by,
selected_filters,
selectedFilters = selected_filters,
url = helpers.getWindowLocation()?.href || 'N/A',
url,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this change as well?

num_results,
result_count,
resultCount = result_count,
numResults = num_results || resultCount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... this doesn't seem to work very well when you end up with:

num_results = 0 and resultCount = undefined

This actually comes out to be undefined and is causing one of the tests to fail: Should respond with a valid response when term, and zero value num_results parameter are provided

I think we can probably use nullish coalescing here and do num_results ?? resultCount. If num_results has a value (even if it's 0) and it's not null, it'll use that value, otherwise it will use resultCount

customer_ids = customerIds,
itemIds,
item_ids = itemIds,
resultCount = numResults || result_count,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use nullish coalescing here as well: num_results ?? result_count

section,
analyticsTags,
resultCount = numResults || result_count || items?.length || 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this change as well?

@jjl014 jjl014 requested a review from a team November 22, 2024 01:07
Copy link
Contributor

@jjl014 jjl014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Just left one minor comment/suggestion, but I think this is ready to go. Thank you for working on this!

@esezen esezen merged commit 0439558 into master Nov 25, 2024
8 checks passed
@esezen esezen deleted the noci-revert-search-result-loaded branch November 25, 2024 10:21
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.

2 participants