@@ -225,7 +225,7 @@ export const ctxToEnumControlProps = (ctx: JsonFormsStateContext, props: OwnProp
225
225
* Make sure, that options are memoized as otherwise the component will rerender for every change,
226
226
* as the options array is recreated every time.
227
227
*/
228
- const options = useMemo ( ( ) => enumProps . options , [ props . options , enumProps . schema ] ) ;
228
+ const options = useMemo ( ( ) => enumProps . options , [ props . options , enumProps . schema , ctx . i18n ?. translate ] ) ;
229
229
return { ...enumProps , options}
230
230
}
231
231
@@ -235,12 +235,19 @@ export const ctxToOneOfEnumControlProps = (ctx: JsonFormsStateContext, props: Ow
235
235
* Make sure, that options are memoized as otherwise the component will rerender for every change,
236
236
* as the options array is recreated every time.
237
237
*/
238
- const options = useMemo ( ( ) => enumProps . options , [ props . options , enumProps . schema ] ) ;
238
+ const options = useMemo ( ( ) => enumProps . options , [ props . options , enumProps . schema , ctx . i18n ?. translate ] ) ;
239
239
return { ...enumProps , options}
240
240
}
241
241
242
- export const ctxToMultiEnumControlProps = ( ctx : JsonFormsStateContext , props : OwnPropsOfControl ) =>
243
- mapStateToMultiEnumControlProps ( { jsonforms : { ...ctx } } , props ) ;
242
+ export const ctxToMultiEnumControlProps = ( ctx : JsonFormsStateContext , props : OwnPropsOfControl ) => {
243
+ const enumProps = mapStateToMultiEnumControlProps ( { jsonforms : { ...ctx } } , props ) ;
244
+ /**
245
+ * Make sure, that options are memoized as otherwise the component will rerender for every change,
246
+ * as the options array is recreated every time.
247
+ */
248
+ const options = useMemo ( ( ) => enumProps . options , [ enumProps . schema , ctx . i18n ?. translate ] ) ;
249
+ return { ...enumProps , options}
250
+ }
244
251
245
252
export const ctxToControlWithDetailProps = (
246
253
ctx : JsonFormsStateContext ,
@@ -318,7 +325,7 @@ export const ctxToEnumCellProps = (
318
325
* Make sure, that options are memoized as otherwise the cell will rerender for every change,
319
326
* as the options array is recreated every time.
320
327
*/
321
- const options = useMemo ( ( ) => cellProps . options , [ ownProps . options , cellProps . schema ] ) ;
328
+ const options = useMemo ( ( ) => cellProps . options , [ ownProps . options , cellProps . schema , ctx . i18n ?. translate ] ) ;
322
329
return { ...cellProps , options}
323
330
} ;
324
331
@@ -331,7 +338,7 @@ export const ctxToOneOfEnumCellProps = (
331
338
* Make sure, that options are memoized as otherwise the cell will rerender for every change,
332
339
* as the options array is recreated every time.
333
340
*/
334
- const options = useMemo ( ( ) => enumCellProps . options , [ props . options , enumCellProps . schema ] )
341
+ const options = useMemo ( ( ) => enumCellProps . options , [ props . options , enumCellProps . schema , ctx . i18n ?. translate ] )
335
342
return { ...enumCellProps , options} ;
336
343
} ;
337
344
0 commit comments