Skip to content

Commit

Permalink
Documents !children.length (#1915)
Browse files Browse the repository at this point in the history
* Documents `!children.length` 

Spent an incredible amount of time figuring out the reasoning of this check and would like to document it.

* Update reactive.ts

Updates comment to the correct version of it.
  • Loading branch information
titoBouzout authored Nov 22, 2023
1 parent b092368 commit 6de59ef
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/solid/src/server/reactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined {
}

function resolveChildren(children: any): unknown {
// `!children.length` avoids running functions that arent signals
if (typeof children === "function" && !children.length) return resolveChildren(children());
if (Array.isArray(children)) {
const results: any[] = [];
Expand Down

0 comments on commit 6de59ef

Please sign in to comment.