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

feat: migrate to autocomplete.js v1 [BREAKING CHANGES] #135

Merged
merged 13 commits into from
Dec 8, 2020

Conversation

bodinsamuel
Copy link
Contributor

@bodinsamuel bodinsamuel commented Nov 17, 2020

Closes #76

Changes

  • Complete migration to autocomplete v1
  • New option for theming
  • algoliasearchNetlify() will throw if missing mandatory option
  • the UI has a minimum of 400px width

Screenshot 2020-11-17 at 14 29 09

How to migrate

  • autocomplete.js now creates its own input, so we no longer support input selector.
    solution: remove your input, create an empty node, e.g:<div id="#search"></div> and use selector: "#search"
  • color property has been removed in favor of theme for improved theming ability.
  • silenceWarnings has been removed
  • autocomplete property has been removed in favor of selector and hitsPerPage at the top level
  • ui no longer adapt to size of the input and follow autocomplete.js panelPlacement: 'input-wrapper-width', to improve this behavior you can adapt the CSS on your own with media queries.

@bodinsamuel bodinsamuel self-assigned this Nov 17, 2020
@bodinsamuel bodinsamuel marked this pull request as ready for review November 17, 2020 13:51
Copy link
Collaborator

@sbellone sbellone left a comment

Choose a reason for hiding this comment

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

Looks promising!
Main issue is that the results are not closed when we click away and stay open forever.

docs/GettingStarted.md Outdated Show resolved Hide resolved
frontend/README.md Outdated Show resolved Hide resolved
frontend/src/AlgoliasearchNetlify.ts Outdated Show resolved Hide resolved
frontend/src/AutocompleteWrapper.ts Outdated Show resolved Hide resolved
frontend/src/AlgoliasearchNetlify.ts Outdated Show resolved Hide resolved
frontend/src/AutocompleteWrapper.ts Outdated Show resolved Hide resolved
frontend/src/AutocompleteWrapper.ts Outdated Show resolved Hide resolved
frontend/src/AutocompleteWrapper.ts Show resolved Hide resolved
frontend/src/types/record.ts Show resolved Hide resolved
frontend/src/types/record.ts Outdated Show resolved Hide resolved
@francoischalifour
Copy link
Member

Main issue is that the results are not closed when we click away and stay open forever.

@sbellone That's because the debug option is used in development in your integration. I wouldn't recommend using it as a default though, as it's mostly useful to inspect the results panel when templating your items. It shouldn't be used in production—in fact, you should see a warning.

We talk about this in the "Debugging" section of our docs.

Co-authored-by: Sylvain Bellone <[email protected]>
@bodinsamuel
Copy link
Contributor Author

  • Disabled openOnFocus and added an option
  • Added option for placeholder
  • Fixed poweredBy
  • Fixed types

Copy link
Collaborator

@sbellone sbellone left a comment

Choose a reason for hiding this comment

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

🚀

@sbellone
Copy link
Collaborator

sbellone commented Dec 4, 2020

I've just found out that it doesn't work correctly if the index has no attributesToSnippet (only the title is displayed in that case).
The current version of the UI is requesting them at runtime, I think this new version should do the same.

@bodinsamuel
Copy link
Contributor Author

if the index has no attributesToSnippet

All Netlify indices are pre configured with attributesToSnippet by default

@sbellone
Copy link
Collaborator

sbellone commented Dec 7, 2020

All Netlify indices are pre configured with attributesToSnippet by default

Automatically? That's not what I have observed. They currently have content as attributesToSnippet because we set it in the initial index settings, but that's it.
Here your UI expect description to be snippeted and it's not the case by default so the description will never be displayed until the users put it as an attribute to snippet. It fallbacks on the content.

What's the problem of sending them at runtime just in case since we rely on them for the display?

@bodinsamuel
Copy link
Contributor Author

Here your UI expect description

ah, we should just change our default index settings then.

@sbellone
Copy link
Collaborator

sbellone commented Dec 7, 2020

Ok but we can also have the UI fallback to the actual fields if no snippetting available, to not have the UI broken because of index settings

@bodinsamuel
Copy link
Contributor Author

to not have the UI broken because of index settings

Did the change but index settings are very tied to the UI, they change it they assume it imo.

@sbellone
Copy link
Collaborator

sbellone commented Dec 8, 2020

True, so a fallback on raw fields if no snippets available permits to let user controlling the length of the snippets actually. As you prefer!

@bodinsamuel bodinsamuel merged commit 1f93199 into master Dec 8, 2020
@bodinsamuel bodinsamuel deleted the feat/autocomplete-v1 branch December 8, 2020 11:32
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.

Migrate to autocomplete.js v1
3 participants