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

keep results on search failure #1747

Merged
merged 14 commits into from
May 17, 2022
Merged

Conversation

yen-tt
Copy link
Contributor

@yen-tt yen-tt commented May 16, 2022

Rendering failures leading to the catch statements in Universal and Vertical search would clear all results. User would still expects other results from the response to render on page. This pr updates the storage.set calls to only update the searchState, instead of storing a new empty results, so the non-problematic result sets can still be render.

The catch statements in core.js will terminate any further rendering of sub components once it encounter a problematic sub component. User expects sdk to render as much as it can. To ensure non-problematic sub-components can still render, this pr added more catch statements in component.js to gracefully handle errors coming from individual child component's data transformation, initialization and mount stage.

J=none
TEST=manual

use dev-keep-data-on-search-failure for SDK version (from this test branch) in the config file of the site with the issue. Searched 'Listings', and see that the same error appeared in console but the other cards still render as normal.
use dev-dont-clear-data-on-failure to test changes in this pr through local html pages that use SDK directly. See that errors are logged but the loading icon is reset to complete during error handling process

@coveralls
Copy link

coveralls commented May 16, 2022

Coverage Status

Coverage increased (+0.06%) to 61.662% when pulling 8cbc8b9 on dev/dont-clear-data-on-failure into 5aa0fd7 on hotfix/v1.14.1.

@yen-tt yen-tt requested a review from a team May 16, 2022 16:48
src/core/core.js Outdated Show resolved Hide resolved
src/core/core.js Outdated
@@ -323,9 +323,6 @@ export default class Core {
window.performance.mark('yext.answers.verticalQueryResponseRendered');
}).catch(error => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to move this catch immediately after coreLibrary.verticalSearch is called, so that it only catches errors thrown by answers-core? We could then have another catch here at the bottom for all other types of errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea that works, I will update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

per discussion with oshi offline, the throw error should already be clear on where the issue is from. Adding additional catch statements here would require handling breaking the then/catch chain mid way or add logic to avoid bleeding into the later catch statements (potentially end up with duplicate update loading state calls and console errors)

@yen-tt yen-tt added the WIP Work in progress label May 16, 2022
src/core/core.js Outdated Show resolved Hide resolved
src/core/core.js Outdated Show resolved Hide resolved
@yen-tt yen-tt added WIP Work in progress and removed WIP Work in progress labels May 16, 2022
@yen-tt yen-tt added WIP Work in progress and removed WIP Work in progress labels May 16, 2022
@yen-tt yen-tt removed the WIP Work in progress label May 17, 2022
@yen-tt yen-tt merged commit 50ff2ab into hotfix/v1.14.1 May 17, 2022
@yen-tt yen-tt deleted the dev/dont-clear-data-on-failure branch May 17, 2022 13:07
@yen-tt yen-tt mentioned this pull request May 17, 2022
yen-tt added a commit that referenced this pull request May 17, 2022
### Bug Fixes
- Update search error handling to gracefully handle rendering of problematic sub-components and ensure search status is set to complete (#1747)
yen-tt added a commit that referenced this pull request May 17, 2022
### Bug Fixes
- Update search error handling to gracefully handle rendering of problematic sub-components and ensure search status is set to complete (#1747)

Co-authored-by: Yen Truong <36055303+yen-tt@users.noreply.github.com>
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.

None yet

4 participants