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

fix(js): do not render empty sections #594

Merged
merged 3 commits into from
May 25, 2021
Merged

Conversation

shortcuts
Copy link
Member

Summary

When having multi-sources, sections without results and noResults template were still rendering their header and/or footer template, which required some extra logic for the user.

Result

Sections without results and noResults template are not rendered anymore.

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 25, 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 7ef2e6f:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-voice-search Configuration
@algolia/autocomplete-example-vue Configuration

Copy link
Member

@francoischalifour francoischalifour left a comment

Choose a reason for hiding this comment

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

That looks good!

We can remove all these checks from our examples now:

if (items.length === 0) {
return null;
}

packages/autocomplete-js/src/render.tsx Outdated Show resolved Hide resolved
shortcuts and others added 2 commits May 25, 2021 16:51
Co-authored-by: François Chalifour <[email protected]>
Copy link
Member

@francoischalifour francoischalifour left a comment

Choose a reason for hiding this comment

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

Perfect, that'll reduce user code!

@shortcuts shortcuts merged commit 527670e into next May 25, 2021
@shortcuts shortcuts deleted the fix/render-emptySections branch May 25, 2021 16:14
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