File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -199,21 +199,20 @@ define([
199
199
return ;
200
200
}
201
201
202
+ if ( algoliaConfig . instant . isDynamicFacetsEnabled && this . isDynamicFacetsEligible ( type ) ) {
203
+ // we cannot pre-bake the dynamicWidget - defer and package the type with the config
204
+ this . dynamicWidgets . push ( { ...config , type } ) ;
205
+ return ;
206
+ }
207
+
202
208
let widget = instantsearch . widgets [ type ] ;
203
209
204
210
if ( config . panelOptions ) {
205
211
widget = instantsearch . widgets . panel ( config . panelOptions ) ( widget ) ;
206
212
delete config . panelOptions ; // facet config attribute only NOT IS widget attribute
207
213
}
208
214
209
- const configuredWidget = widget ( config ) ;
210
-
211
- if ( algoliaConfig . instant . isDynamicFacetsEnabled && this . isDynamicFacetsEligible ( type ) ) {
212
- this . dynamicWidgets . push ( configuredWidget ) ;
213
- return ;
214
- }
215
-
216
- search . addWidgets ( [ configuredWidget ] ) ;
215
+ search . addWidgets ( [ widget ( config ) ] ) ;
217
216
} ,
218
217
219
218
/**
@@ -227,7 +226,18 @@ define([
227
226
search . addWidget (
228
227
dynamicWidgets ( {
229
228
container : '#instant-search-facets-container' ,
230
- widgets : this . dynamicWidgets . map ( widget => container => widget )
229
+ widgets : this . dynamicWidgets . map ( config => {
230
+ const { type, ...raw } = config ;
231
+ const widget = instantsearch . widgets [ type ] ;
232
+ // The dynamicWidgets container must be derived at run time
233
+ return container => {
234
+ const newConfig = {
235
+ ...raw ,
236
+ container
237
+ } ;
238
+ return widget ( newConfig ) ;
239
+ } ;
240
+ } )
231
241
} )
232
242
) ;
233
243
} ,
You can’t perform that action at this time.
0 commit comments