mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-03-25 21:20:38 +08:00
Merge branch 'develop' into release
This commit is contained in:
commit
09b054a11f
@ -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>
|
||||
);
|
||||
|
||||
|
17
packages/editor-sdk/src/utils/object.ts
Normal file
17
packages/editor-sdk/src/utils/object.ts
Normal 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 };
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user