Skip to content

Commit 65ebe8c

Browse files
authored
Merge pull request #247 from dunglas/fix/next-0
fix(next): fix display of 0 when the list is empty
2 parents 57f49cc + 3cad20a commit 65ebe8c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

templates/next/components/foo/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const List: FunctionComponent<Props> = ({ {{{name}}} }) => (
2020
</tr>
2121
</thead>
2222
<tbody>
23-
{ {{{name}}} && {{{name}}}.length && {{{name}}}.map({{{lc}}} => (
23+
{ {{{name}}} && ({{{name}}}.length !== 0) && {{{name}}}.map({{{lc}}} => (
2424
<ListItem key={ {{{lc}}}['@id'] } {{{lc}}}={ {{{lc}}} } />
2525
))}
2626
</tbody>

templates/next/pages/foos/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface Props {
99
}
1010

1111
const Page: NextComponentType<NextPageContext, Props, Props> = ({collection}) => (
12-
<List {{{name}}}={collection['{{{hydraPrefix}}}member'] || []}/>
12+
<List {{{name}}}={collection['{{{hydraPrefix}}}member']}/>
1313
);
1414

1515
Page.getInitialProps = async () => {

0 commit comments

Comments
 (0)