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

PART 2 - configurable query suggestions & recent queries #1267

Merged
merged 11 commits into from
Oct 6, 2021

Conversation

ThibodeauJF
Copy link
Contributor

@ThibodeauJF ThibodeauJF commented Sep 28, 2021

Part 1: #1261

Final Result:
Screen Shot 2021-09-28 at 6 13 15 PM

@github-actions
Copy link

Thanks for your contribution @ThibodeauJF !
When your pull-request is ready to be merged, check the box below to merge it

  • Merge! :shipit:

@github-actions
Copy link

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:

(optional scope):

Example:

feat(headless): add result-list controller

Bundle Size

File Compression Old (kb) New (kb) Change (%)
headless.js bundled 371.6 371.6 0
minified 165.3 165.3 0
gzipped 48 48 0
headless.esm.js bundled 361.9 361.9 0
minified 206.1 206.1 0
gzipped 52.8 52.8 0

@ThibodeauJF ThibodeauJF marked this pull request as ready for review September 29, 2021 15:45
@ThibodeauJF ThibodeauJF requested a review from a team as a code owner September 29, 2021 15:45
@ThibodeauJF ThibodeauJF requested review from olamothe, samisayegh and btaillon-coveo and removed request for a team September 29, 2021 15:45
@ThibodeauJF ThibodeauJF changed the title (do not review) PART 2 - configurable query suggestions & recent queries PART 2 - configurable query suggestions & recent queries Sep 29, 2021
);

return {
position: Array.from(this.host.parentNode!.children).indexOf(this.host),
Copy link
Member

Choose a reason for hiding this comment

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

is that parentNode! actually safe ? In theory, it could be possible to have someone create a search box element in JS and not attach it to the DOM, no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would expect it to be, but I'll handle it just in case (ps: this is the child query suggestion configuration element)

private disableFeature() {
if (!this.userWarned) {
this.userWarned = true;
this.bindings.engine.logger.warn(
Copy link
Member

Choose a reason for hiding this comment

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

I think there would be a way to remove the userWarned flag by using a once(()=> [... the log message ...]) kinda pattern in a utility file.

https://stackoverflow.com/a/23837412

SearchBoxSuggestionsBindings,
} from '../suggestions-common';

const localStorageKey = 'recent-queries';
Copy link
Member

Choose a reason for hiding this comment

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

It's still early, but I think we can safely assume that we will be re-using local storage features in the future in Atomic.

If only for the need to be scoped to a specific namespace (coveo), doing safe read for iOS in incognito mode (local storage is undefined in those case) and other things you might discover of you look into what is done for JSUI, I would vote to create a utility module to interact with local storage.

This can be done in another PR, but ... I think it's important to do it sooner than later. We've had quite a lot of bugs due to local storage in JSUI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay! I'll look into it 👀

};
}

private retrieveLocalStorage() {
Copy link
Member

Choose a reason for hiding this comment

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

Related to above comment about local storage module, retrieve and update operations to local storage should be treated as operations that can throw.

@ThibodeauJF ThibodeauJF merged commit e5a4cdc into KIT-853 Oct 6, 2021
@ThibodeauJF ThibodeauJF deleted the KIT-853-1 branch October 6, 2021 11:46
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