Merge branch 'develop' into release

This commit is contained in:
bowen tan 2025-03-11 10:55:56 +08:00
commit 09b054a11f
3 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,7 @@ import tern, { Def } from 'tern';
import { getTypeString } from '../../../utils/type';
import ecmascript from '../../../constants/ecmascript';
import { PREVENT_POPOVER_WIDGET_CLOSE_CLASS } from '../../../constants';
import { stringify } from '../../../utils/object';
injectGlobal`
.CodeMirror-hints {
@ -386,7 +387,7 @@ export const ExpressionEditor = React.forwardRef<
<Box fontWeight="bold" marginBottom="4px">
{error ? 'Error' : getTypeString(evaledValue?.value)}
</Box>
{error || JSON.stringify(evaledValue?.value, null, 2)}
{error || stringify(evaledValue?.value)}
</Box>
);

View File

@ -0,0 +1,17 @@
function stringify(obj: unknown) {
const cache: unknown[] = [];
JSON.stringify(obj, (_, value) => {
if (typeof value === 'object' && value !== null) {
// Duplicate reference found, discard key
if (cache.includes(value)) return;
// Store value in our collection
cache.push(value);
}
return value;
});
}
export { stringify };

View File

@ -172,7 +172,6 @@ export const ImplWrapperMain = React.forwardRef<HTMLDivElement, ImplWrapperProps
<Impl
data-sunmao-id={c.id}
ref={ref}
key={c.id}
{...omit(props, ['slotContext'])}
{...mergedProps}
slotsElements={slotElements}
@ -185,7 +184,6 @@ export const ImplWrapperMain = React.forwardRef<HTMLDivElement, ImplWrapperProps
return (
<ComponentErrorBoundary
key={c.id}
componentId={c.id}
onRef={onRef}
onRecoverFromError={onRecoverFromError}