question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing custom template to loadMore slot

See original GitHub issue

Bug 🐞

What is the current behavior?

It’s not possible to customise Show more button when passing custom template to default slot, because loadMore slot is nested inside it.

loadPrevious slot is fine.

https://github.com/algolia/vue-instantsearch/blob/dca88f90f82a5e9e620ae2cd12e5a3efc8475910/src/components/InfiniteHits.vue#L45

Make a sandbox with the current behavior

https://codesandbox.io/s/vueinstantsearchapp-wypg0

What is the expected behavior?

To work the same as “Show previous”.

Does this happen only in specific situations?

No.

What is the proposed solution?

Move loadMore slot outside of default slot, the same way as loadPrevious.

What is the version you are using?

2.2.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ArcoMulcommented, Feb 28, 2022

I imagine here: https://www.algolia.com/doc/api-reference/widgets/infinite-hits/vue/#widget-param-loadmore

Something like:

Note that when overriding the default slot, the loadMore slot also get overriden, in that case include the template code of the loadMore slot in the default slot and don’t define a loadMore slot.

1reaction
alexcrooxcommented, Nov 4, 2019

No worries, just posting a code example for anyone else that stumbles on the issue to save them time 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using templates and slots - Web Components | MDN
Slots are identified by their name attribute, and allow you to define placeholders in your template that can be filled with any markup...
Read more >
How to pass a custom template to an Angular component?
Solution #1: Multi-slot content projection. Content projection is simple to use and provides a clear to read syntax, which is always a plus....
Read more >
Passing data from a component that contains slot content to ...
1 Answer 1 · template · div · h2 · h2 · layout-card-overflow · slot · slot · layout-card-overflow ...
Read more >
Assign content to multiple slots in LWC: how to insert the same ...
I would recommend you to create 2 slots in your c-card component ( header and footer ), and to create another component c-actions...
Read more >
Shadow DOM slots, composition
Just like built-in browser <select> expects <option> items, our <custom-tabs> may expect the actual tab content to be passed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found