Skip to content

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

Merged
shortcuts merged 3 commits intonextfrom
fix/render-emptySections
May 25, 2021
Merged

fix(js): do not render empty sections#594
shortcuts merged 3 commits intonextfrom
fix/render-emptySections

Conversation

@shortcuts
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Contributor

@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;
}

Comment thread packages/autocomplete-js/src/render.tsx Outdated
shortcuts and others added 2 commits May 25, 2021 16:51
Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@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