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

docs(example): set up GitHub filters example with Algolia #814

Merged
merged 6 commits into from
Nov 15, 2021

Conversation

sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Nov 11, 2021

This swaps the static sources for repositories, authors and organizations with Algolia indices. This allows us to leverage Algolia features (full-text search, highlighting, custom ranking, search for facet values, etc.).

When a tag is selected, it's removed from the available filters to avoid adding the same tag twice and polluting the results.

Sans.titre.mov

The indices are static extracts from the GitHub public API, indexed in Algolia. They contain a list of public repos from Algolia and CodeSandbox, along with public members of both organizations.

sandbox

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 11, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 19523b2:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-github-notification-filters PR

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

works nicely! slightly confusing there's no submit override but it just refreshes

@@ -148,7 +154,7 @@ autocomplete<AutocompleteItem>({
showQuerySource && querySource,
showPrefixesSource && prefixesSource,
showPostfixesSource && postfixesSource,
].filter(Boolean);
].filter(Boolean) as Array<AutocompleteSource<AutocompleteItem>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is the cast needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not every source returns items that exactly satisfy the AutocompleteItem contract (sometimes there's more data, sometimes there's less), but there's enough overlap so that it doesn't matter, and each source has its own template anyway.

I think I can improve types in a separate PR since this is only a demo.

examples/github-notification-filters/app.tsx Outdated Show resolved Hide resolved
Co-authored-by: Haroen Viaene <hello@haroen.me>
@sarahdayan sarahdayan merged commit f22696b into next Nov 15, 2021
@sarahdayan sarahdayan deleted the docs/github-filters-algolia branch November 15, 2021 16:25
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