Skip to content

Commit 925f816

Browse files
authored
fix(UIRouterContextComponent): Handle array of length 1 (#526)
1 parent a1da8ce commit 925f816

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/react/UIRouterReactContext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ export function UIRouterContextComponent(props: {
6262

6363
// We know the AngularJS state. Now render the {children}
6464
const childrenCount = React.Children.count(children);
65+
const isArray = Array.isArray(children);
6566

6667
return (
6768
<UIRouterContext.Provider value={(inherited && routerFromReactContext) || contextFromAngularJS.router}>
6869
<UIViewContext.Provider value={(inherited && parentUIViewFromReactContext) || contextFromAngularJS.addr}>
69-
{childrenCount === 1 ? React.Children.only(children) : <div>{children}</div>}
70+
{childrenCount === 1 && !isArray ? React.Children.only(children) : <div>{children}</div>}
7071
</UIViewContext.Provider>
7172
</UIRouterContext.Provider>
7273
);

0 commit comments

Comments
 (0)