-
Notifications
You must be signed in to change notification settings - Fork 496
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
html template function returns "undefined" with empty string #6075
Labels
Library: InstantSearch.js
Issues in instantsearch.js
Resolution: Needs More Information
Scope: Templating
Type: Bug
Comments
For which component is this, I just did a quick test for hits and can't reproduce: test('renders empty template using `html`', async () => {
const container = document.createElement('div');
const searchClient = createMockedSearchClient();
const search = instantsearch({ indexName: 'indexName', searchClient });
search.addWidgets([
hits({
container,
templates: {
item(_, { html }) {
return html``;
},
},
}),
]);
search.start();
await wait(0);
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="ais-Hits"
>
<ol
class="ais-Hits-list"
>
<li
class="ais-Hits-item"
/>
<li
class="ais-Hits-item"
/>
</ol>
</div>
</div>
`);
}); If there's anything happening that's causing it, I think it may be around here in the code, where undefined somehow gets casted as a string? If there's a clear repro, I wonder if the
|
Haroenv
added
Library: InstantSearch.js
Issues in instantsearch.js
Scope: Templating
Type: Bug
Resolution: Needs More Information
and removed
triage
Issues to be categorized by the team
labels
Feb 26, 2024
It was in my template.empty, e.g.,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Library: InstantSearch.js
Issues in instantsearch.js
Resolution: Needs More Information
Scope: Templating
Type: Bug
馃悰 Current behavior
Somewhere between [email protected] and 4.22.1, the html function used in a template changed such that
html``
(empty string in html function) returns stringundefined
to template.馃攳 Steps to reproduce
return html``
in a templateLive reproduction
na
馃挱 Expected behavior
Should be equivalent to
return ''
instead ofreturn 'undefined'
Package version
[email protected]
Operating system
na
Browser
na
Code of Conduct
The text was updated successfully, but these errors were encountered: