Skip to content

Commit 67546f4

Browse files
fix: address React 19 BC due to which configuration components do not apply their options (T1269933) (#28654)
1 parent e32f56f commit 67546f4

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

packages/devextreme-react/src/core/component-base.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { DXRemoveCustomArgs, DXTemplateCreator, InitArgument } from './types';
2525
import { elementPropNames, getClassName } from './widget-config';
2626
import { TemplateManager } from './template-manager';
2727
import { ComponentProps } from './component';
28-
import { ElementType } from './configuration/react/element';
28+
import { ElementType, IOptionElement } from './configuration/react/element';
2929
import { IConfigNode } from './configuration/config-node';
3030

3131
import {
@@ -341,19 +341,24 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(
341341

342342
const templateContainer = useMemo(() => document.createElement('div'), []);
343343

344-
const options = useOptionScanning(
345-
{
346-
type: ElementType.Option,
347-
descriptor: {
348-
name: '',
349-
isCollection: false,
350-
templates: templateProps,
351-
initialValuesProps: defaults,
352-
predefinedValuesProps: {},
353-
expectedChildren,
354-
},
355-
props,
344+
const elementDescriptor: IOptionElement = useMemo(() => ({
345+
type: ElementType.Option,
346+
descriptor: {
347+
name: '',
348+
isCollection: false,
349+
templates: templateProps,
350+
initialValuesProps: defaults,
351+
predefinedValuesProps: {},
352+
expectedChildren,
356353
},
354+
props,
355+
}), [
356+
templateProps,
357+
defaults,
358+
]);
359+
360+
const options = useOptionScanning(
361+
elementDescriptor,
357362
props.children,
358363
templateContainer,
359364
Symbol('initial update token'),

packages/devextreme-react/src/core/use-option-scanning.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
useContext,
66
useRef,
77
useLayoutEffect,
8+
useMemo,
89
} from 'react';
910

1011
import { ElementType, getElementType, IOptionElement } from './configuration/react/element';
@@ -31,7 +32,13 @@ export function useOptionScanning(
3132

3233
const updateToken = Symbol('update token');
3334

34-
const configBuilder = createConfigBuilder(optionElement, parentFullName);
35+
const configBuilder = useMemo(
36+
() => createConfigBuilder(optionElement, parentFullName),
37+
[
38+
optionElement,
39+
parentFullName,
40+
],
41+
);
3542

3643
Children.forEach(
3744
children,

0 commit comments

Comments
 (0)