Skip to content

Commit ad85b54

Browse files
fix: address React 19 BC due to which configuration components do not apply their options (T1269933) (#28658)
1 parent 369219b commit ad85b54

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

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

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { elementPropNames, getClassName } from './widget-config';
2626
import { TemplateManager } from './template-manager';
2727
import { ComponentProps } from './component';
2828
import { ElementType } from './configuration/react/element';
29-
import { IConfigNode } from './configuration/config-node';
3029

3130
import {
3231
NestedOptionContext,
@@ -96,7 +95,25 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(
9695

9796
const prevPropsRef = useRef<P & ComponentBaseProps>();
9897

99-
let widgetConfig: IConfigNode;
98+
const templateContainer = useMemo(() => document.createElement('div'), []);
99+
100+
const [widgetConfig, context] = useOptionScanning(
101+
{
102+
type: ElementType.Option,
103+
descriptor: {
104+
name: '',
105+
isCollection: false,
106+
templates: templateProps,
107+
initialValuesProps: defaults,
108+
predefinedValuesProps: {},
109+
expectedChildren,
110+
},
111+
props,
112+
},
113+
props.children,
114+
templateContainer,
115+
Symbol('initial update token'),
116+
);
100117

101118
const restoreTree = useCallback(() => {
102119
if (childElementsDetached.current && childNodes.current?.length && element.current) {
@@ -249,6 +266,7 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(
249266
instance.current,
250267
subscribableOptions,
251268
independentEvents,
269+
widgetConfig,
252270
]);
253271

254272
const onTemplatesRendered = useCallback(() => {
@@ -279,6 +297,7 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(
279297
scheduleTemplatesUpdate,
280298
updateCssClasses,
281299
props,
300+
widgetConfig,
282301
]);
283302

284303
const onComponentMounted = useCallback(() => {
@@ -339,29 +358,6 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(
339358
shouldRestoreFocus.current,
340359
]);
341360

342-
const templateContainer = useMemo(() => document.createElement('div'), []);
343-
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,
356-
},
357-
props.children,
358-
templateContainer,
359-
Symbol('initial update token'),
360-
);
361-
362-
[widgetConfig] = options;
363-
const [, context] = options;
364-
365361
useLayoutEffect(() => {
366362
onComponentMounted();
367363

0 commit comments

Comments
 (0)