Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-haynes committed Oct 11, 2023
1 parent 78c6dea commit fc59b1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/application/src/monitor.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import type { EventType, MessagePayload } from '@bos-web-engine/container';

import type {
ComponentInstance,
ComponentMetrics,
} from './types';
import type { ComponentInstance, ComponentMetrics } from './types';
import { BWEMessage } from './types';

interface ComponentId {
Expand Down Expand Up @@ -139,7 +136,7 @@ export function ComponentMonitor({
switch (message.type) {
case 'component.render': {
const { type, props } = message.node;
const formattedChildren = message.childComponents.length
const formattedChildren = message.childComponents?.length
? `with children ${message.childComponents
.map(({ componentId }) =>
formatComponentId(parseComponentId(componentId))
Expand Down
6 changes: 5 additions & 1 deletion packages/application/src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import type {
ComponentDOMElement,
} from './types';

function isChildrenAllowed(elementType: string) {
return !(elementType in ['img']);
}

export function createElement({
children,
id,
Expand All @@ -17,7 +21,7 @@ export function createElement({
return React.createElement(
type,
deserializeProps({ id, props, onMessageSent }),
children
isChildrenAllowed(type) ? children : undefined
);
}

Expand Down
4 changes: 4 additions & 0 deletions packages/iframe/src/SandboxedIframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ function buildSandboxedComponent({
parentId: componentId,
});
if (!serializedNode?.type) {
return;
}
function stringify(value) {
if (!value) {
return '';
Expand Down

0 comments on commit fc59b1a

Please sign in to comment.