Skip to content

Commit

Permalink
🐛 Fix children crashing the test app
Browse files Browse the repository at this point in the history
  • Loading branch information
FalseLobster committed Mar 24, 2020
1 parent bc1b95c commit 2344c65
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/framework/foundation-composable/src/Composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import { useCompoundPrepare } from './Composable.slots';
import { renderSlot } from './slots';
import { ISlotProps, mergeSettings } from '@uifabricshared/foundation-settings';

// just a generic object with children specified as props
type IWithChildren<T> = T & { children?: React.ReactNode[] };

export function atomicRender<TProps extends object, TState = object>(
Slots: ISlots<ISlotProps<TProps>>,
_renderData: IRenderData<ISlotProps<TProps>, TState>,
Expand Down Expand Up @@ -96,7 +93,7 @@ export function composable<TType>(
// create the actual implementation
const render = (userProps: IProps) => {
// split out children, they will be excluded from the prop preparation phase
const { children, ...props } = userProps as IWithChildren<IProps>;
const { children, ...props } = userProps as React.PropsWithChildren<IProps>;

// prepare the props, all the way down the tree, also build the slots
const { renderData, Slots } = useCompoundPrepare<IProps, IThisSlotProps, IState>(
Expand All @@ -105,7 +102,7 @@ export function composable<TType>(
);

// now do the render, adding the children back in
return options.render(Slots, renderData, ...children);
return options.render(Slots, renderData, children);
};
render.displayName = options.displayName;

Expand Down

0 comments on commit 2344c65

Please sign in to comment.