Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 18d8895

Browse files
fix(templates): prepare InstantSearch template for v4 (#441)
1 parent b738140 commit 18d8895

File tree

2 files changed

+14
-35
lines changed

2 files changed

+14
-35
lines changed

e2e/__snapshots__/templates.test.js.snap

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3229,14 +3229,11 @@ const search = instantsearch({
32293229
searchClient,
32303230
});
32313231
3232-
search.addWidget(
3232+
search.addWidgets([
32333233
instantsearch.widgets.searchBox({
32343234
container: '#searchbox',
32353235
placeholder: 'Search placeholder',
3236-
})
3237-
);
3238-
3239-
search.addWidget(
3236+
}),
32403237
instantsearch.widgets.hits({
32413238
container: '#hits',
32423239
templates: {
@@ -3247,28 +3244,19 @@ search.addWidget(
32473244
</article>
32483245
\`,
32493246
},
3250-
})
3251-
);
3252-
3253-
search.addWidget(
3247+
}),
32543248
instantsearch.widgets.refinementList({
32553249
container: '#facet1-list',
32563250
attribute: 'facet1',
3257-
})
3258-
);
3259-
3260-
search.addWidget(
3251+
}),
32613252
instantsearch.widgets.refinementList({
32623253
container: '#facet2-list',
32633254
attribute: 'facet2',
3264-
})
3265-
);
3266-
3267-
search.addWidget(
3255+
}),
32683256
instantsearch.widgets.pagination({
32693257
container: '#pagination',
3270-
})
3271-
);
3258+
}),
3259+
]);
32723260
32733261
search.start();"
32743262
`;

src/templates/InstantSearch.js/src/app.js.hbs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ const search = instantsearch({
1010
searchClient,
1111
});
1212

13-
search.addWidget(
13+
search.addWidgets([
1414
instantsearch.widgets.searchBox({
1515
container: '#searchbox',
1616
{{#if searchPlaceholder}}
1717
placeholder: '{{searchPlaceholder}}',
1818
{{/if}}
19-
})
20-
);
21-
22-
search.addWidget(
19+
}),
2320
instantsearch.widgets.hits({
2421
container: '#hits',
2522
{{#if attributesToDisplay}}
@@ -36,22 +33,16 @@ search.addWidget(
3633
`,
3734
},
3835
{{/if}}
39-
})
40-
);
41-
42-
{{#each attributesForFaceting}}
43-
search.addWidget(
36+
}),
37+
{{#each attributesForFaceting}}
4438
instantsearch.widgets.refinementList({
4539
container: '#{{this}}-list',
4640
attribute: '{{this}}',
47-
})
48-
);
49-
50-
{{/each}}
51-
search.addWidget(
41+
}),
42+
{{/each}}
5243
instantsearch.widgets.pagination({
5344
container: '#pagination',
5445
})
55-
);
46+
]);
5647

5748
search.start();

0 commit comments

Comments
 (0)