Skip to content

Commit 5caeb87

Browse files
committed
Don't create a new List if source is already a list
1 parent 905d76a commit 5caeb87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Our.Umbraco.GraphQL/Types/ConnectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static Connection<TSource> ToConnection<TSource, TParent>(this IEnumerabl
2020
public static Connection<TSource> ToConnection<TSource, TParent>(this IEnumerable<TSource> source,
2121
ResolveConnectionContext<TParent> context, int totalCount)
2222
{
23-
var items = source.ToList();
23+
var items = source as List<TSource> ?? source.ToList();
2424

2525
var after = context.After;
2626
var before = context.Before;

0 commit comments

Comments
 (0)