vite-plugin-taro-runtime 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/react.esm.js +11 -1
- package/package.json +1 -1
package/dist/react/react.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PLATFORM_TYPE, isObject, isEnableTTDom, isString, isFunction, toCamelCase, UNITLESS_PROPERTIES_SET, isNumber, capitalize, internalComponents, isUndefined, noop, isBoolean, hooks, ensure } from '@tarojs/shared';
|
|
2
2
|
import { setInnerHTML, convertNumber2PX, eventHandlerTTDom } from '@tarojs/runtime';
|
|
3
3
|
import host from '\0vpt:renderer-host';
|
|
4
|
-
import { version } from 'react';
|
|
4
|
+
import { isValidElement, version } from 'react';
|
|
5
5
|
import Reconciler from 'react-reconciler';
|
|
6
6
|
import {
|
|
7
7
|
ConcurrentRoot,
|
|
@@ -577,6 +577,16 @@ function setProperty(dom, name, value, oldValue) {
|
|
|
577
577
|
if (process.env.TARO_ENV === 'tt' && isEnableTTDom() && !IS_DATASET_OR_ARIA.test(name)) {
|
|
578
578
|
name = toCamelCase(name);
|
|
579
579
|
}
|
|
580
|
+
// React elements belong in children, not host data. Keep the O(1) check entirely development-only.
|
|
581
|
+
if (process.env.NODE_ENV !== 'production' && isValidElement(value)) {
|
|
582
|
+
if (!isValidElement(oldValue)) {
|
|
583
|
+
console.warn(`[VPT] React element ignored for host attribute "${name}". Render it as a child instead.`);
|
|
584
|
+
if (oldValue != null) {
|
|
585
|
+
dom.removeAttribute(name);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
580
590
|
if (value == null) {
|
|
581
591
|
dom.removeAttribute(name);
|
|
582
592
|
}
|