Skip to content

Commit afa20ac

Browse files
authored
Change the map function so that when the result.get() is undefined, we set it to the empty array (#1169)
* Change the map function so that when the result.get() is undefined, we set it to the empty array. This prevents the subsequent read of length from failing. * Move this check out of the list check The list check will get some extra code that we don't want to run just because result.get() is undefind.
1 parent 500e962 commit afa20ac

File tree

1 file changed

+4
-0
lines changed
  • packages/runner/src/builtins

1 file changed

+4
-0
lines changed

packages/runner/src/builtins/map.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export function map(
6060
return (log: ReactivityLog) => {
6161
let { list, op } = inputsCell.getAsQueryResult([], log);
6262

63+
// If the result's value is undefined, set it to the empty array.
64+
if (result.get() === undefined) {
65+
result.setAtPath([], [], log);
66+
}
6367
// If the list is undefined it means the input isn't available yet.
6468
// Correspondingly, the result should be []. TODO: Maybe it's important to
6569
// distinguish empty inputs from undefined inputs?

0 commit comments

Comments
 (0)