Clarification on Customizing the UI with connectHits? #5048
Replies: 2 comments 3 replies
-
I think it might just be that your Maybe just do |
Beta Was this translation helpful? Give feedback.
-
Yes, the first error regarding the DOM element was just based on their recommended configuration. Which I tried blindly in case there was something I was just missing. In fact, the #hit needed to be #algolia-hits, which returns results. However, the results are not rendered. This is my template page with a custom rendered widget which still does not work.
This config produces this result |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The documentation is confusing me when it comes to context. I'm using instantsearch.js within the WebDevStudios / wp-search-with-algolia plugin.
The issue I'm trying to solve: The default hit is wrapping the widget template in
<ol> <li>
and I'm trying to remove that. The documentation is a bit confusing when I'm looking at these when creating a render function.Hits:
const { hits } = renderOptions;
But then it queries an element in the DOM?document.querySelector('#hits').innerHTML =
Results:
const { results } = renderOptions;
also queries the DOMdocument.querySelector('#hits').innerHTML =
wdgetParams:
const { widgetParams } = renderOptions;
appears to focus in on widget params but to me thiswidgetParams.container.innerHTML = '...';
looks like what I want, but nothing is working. It's not rendering anything.Besides the confusion around said... what I'm working with.
The original code to instantiate hits
What I'm doing
Before search.addWidget
Replaced the original instantiate with
This is returning nothing... not even an error.
I'm positive the original template is coming from Hits.tsx, though mine looks a bit different. The plugin instantsearch.js is wrapped in is probably using an older version. This is what I have.
What should the render function look like to render the item/ hit without being wrapped in
<ol> <li>
elements?I should add I've tried all variations of the render function. Some of these return text for each result (I forget the exact verbiage) but it was obviously not right. I'm missing how to get a clean hit returned so the widget template can do its thing.
Edit: Including the widget template for reference
Beta Was this translation helpful? Give feedback.
All reactions