Skip to content

Commit 09540a4

Browse files
refactor!: remove hogan.js (#6378)
BREAKING CHANGE : Hogan.js and raw HTML templates will no longer work. `bindEvent` also removed. --------- Co-authored-by: Haroen Viaene <[email protected]>
1 parent 1a9f6d6 commit 09540a4

File tree

100 files changed

+721
-2252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+721
-2252
lines changed

babel.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ module.exports = (api) => {
8787

8888
// false positive (spread)
8989
'Object.getOwnPropertyDescriptors',
90+
91+
// @TODO: see when we remove IE11 support
92+
'Object.fromEntries',
93+
'Object.entries',
9094
];
9195
if (defaultShouldInject && !exclude.includes(name)) {
9296
throw new Error(

packages/algolia-experiences/src/render.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ function blockToWidget(child: Block, container: HTMLElement): Widget[] {
293293
return [
294294
panel<typeof widgets['ais.refinementList']>({
295295
templates: {
296-
header,
296+
header: () => header,
297297
collapseButtonText: ({ collapsed }) => (
298298
// @TODO: put this style in a stylesheet
299299
<span style="cursor: pointer">{collapsed ? '+' : '-'}</span>

packages/instantsearch.js/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929
"@algolia/events": "^4.0.1",
3030
"@types/dom-speech-recognition": "^0.0.1",
3131
"@types/google.maps": "^3.55.12",
32-
"@types/hogan.js": "^3.0.0",
3332
"@types/qs": "^6.5.3",
3433
"algoliasearch-helper": "3.22.5",
35-
"hogan.js": "^3.0.2",
3634
"htm": "^3.0.0",
3735
"instantsearch-ui-components": "0.9.0",
3836
"preact": "^10.10.0",

packages/instantsearch.js/src/__tests__/common-widgets.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ const testSetups: TestSetupsMap<TestSuites> = {
418418
container: document.body.appendChild(document.createElement('div')),
419419
...widgetParams,
420420
templates: {
421-
labelText: label,
421+
labelText: label ? () => label : undefined,
422422
},
423423
}),
424424
])

packages/instantsearch.js/src/components/Answers/__tests__/Answers-test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const defaultProps: AnswersProps = {
2323
},
2424
templateProps: {
2525
templates: {
26-
header: 'header',
27-
loader: 'loader',
28-
item: 'item',
26+
header: () => 'header',
27+
loader: () => 'loader',
28+
item: () => 'item',
2929
},
3030
},
3131
};

packages/instantsearch.js/src/components/Breadcrumb/__tests__/Breadcrumb-test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const defaultProps: BreadcrumbProps = {
2828
templateProps: prepareTemplateProps({
2929
defaultTemplates,
3030
templates: {},
31-
templatesConfig: {},
3231
}),
3332
};
3433

packages/instantsearch.js/src/components/GeoSearchControls/__tests__/GeoSearchControls-test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ describe('GeoSearchControls', () => {
2424

2525
const templateProps = prepareTemplateProps({
2626
defaultTemplates: {
27-
toggle: 'toggle',
28-
redo: 'redo',
29-
reset: 'reset',
30-
HTMLMarker: '',
27+
toggle: () => 'toggle',
28+
redo: () => 'redo',
29+
reset: () => 'reset',
30+
HTMLMarker: () => '',
3131
},
3232
templates: {},
33-
templatesConfig: {},
3433
});
3534

3635
const defaultProps = {

packages/instantsearch.js/src/components/InfiniteHits/InfiniteHits.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ const InfiniteHits = ({
8181
results,
8282
hits,
8383
insights,
84-
bindEvent,
8584
sendEvent,
8685
hasShowPrevious,
8786
showPrevious,
@@ -188,7 +187,6 @@ const InfiniteHits = ({
188187
return index;
189188
},
190189
}}
191-
bindEvent={bindEvent}
192190
sendEvent={sendEvent}
193191
/>
194192
))}

packages/instantsearch.js/src/components/InfiniteHits/__tests__/InfiniteHits-test.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ describe('InfiniteHits', () => {
6161
isLastPage: false,
6262
templateProps: {
6363
templates: {
64-
empty: 'empty',
65-
showPreviousText: 'showPreviousText',
66-
showMoreText: 'showMoreText',
67-
item: 'item',
64+
empty: () => 'empty',
65+
showPreviousText: () => 'showPreviousText',
66+
showMoreText: () => 'showMoreText',
67+
item: () => 'item',
6868
},
6969
},
7070
cssClasses,
@@ -101,10 +101,10 @@ describe('InfiniteHits', () => {
101101
isLastPage: true,
102102
templateProps: {
103103
templates: {
104-
empty: 'empty',
105-
showPreviousText: 'showPreviousText',
106-
showMoreText: 'showMoreText',
107-
item: 'item',
104+
empty: () => 'empty',
105+
showPreviousText: () => 'showPreviousText',
106+
showMoreText: () => 'showMoreText',
107+
item: () => 'item',
108108
},
109109
},
110110
cssClasses,
@@ -130,10 +130,10 @@ describe('InfiniteHits', () => {
130130
isLastPage: false,
131131
templateProps: {
132132
templates: {
133-
empty: 'empty',
134-
showPreviousText: 'showPreviousText',
135-
showMoreText: 'showMoreText',
136-
item: 'item',
133+
empty: () => 'empty',
134+
showPreviousText: () => 'showPreviousText',
135+
showMoreText: () => 'showMoreText',
136+
item: () => 'item',
137137
},
138138
},
139139
cssClasses,
@@ -159,10 +159,10 @@ describe('InfiniteHits', () => {
159159
isLastPage: true,
160160
templateProps: {
161161
templates: {
162-
empty: 'empty',
163-
showPreviousText: 'showPreviousText',
164-
showMoreText: 'showMoreText',
165-
item: 'item',
162+
empty: () => 'empty',
163+
showPreviousText: () => 'showPreviousText',
164+
showMoreText: () => 'showMoreText',
165+
item: () => 'item',
166166
},
167167
},
168168
cssClasses,
@@ -199,10 +199,10 @@ describe('InfiniteHits', () => {
199199
isLastPage: false,
200200
templateProps: {
201201
templates: {
202-
empty: 'empty',
203-
showPreviousText: 'showPreviousText',
204-
showMoreText: 'showMoreText',
205-
item: 'item',
202+
empty: () => 'empty',
203+
showPreviousText: () => 'showPreviousText',
204+
showMoreText: () => 'showMoreText',
205+
item: () => 'item',
206206
},
207207
},
208208
cssClasses,
@@ -244,10 +244,10 @@ describe('InfiniteHits', () => {
244244
isLastPage: true,
245245
templateProps: {
246246
templates: {
247-
empty: 'empty',
248-
showPreviousText: 'showPreviousText',
249-
showMoreText: 'showMoreText',
250-
item: 'item',
247+
empty: () => 'empty',
248+
showPreviousText: () => 'showPreviousText',
249+
showMoreText: () => 'showMoreText',
250+
item: () => 'item',
251251
},
252252
},
253253
cssClasses,

packages/instantsearch.js/src/components/InfiniteHits/__tests__/InfiniteHits.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ describe('InfiniteHits', () => {
8282
return '';
8383
},
8484
},
85-
templatesConfig: {},
8685
templates: {},
8786
}),
8887
...props,

0 commit comments

Comments
 (0)