File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { type DocImpl , getDoc } from "../doc.ts" ;
2
+ import { isCellLink } from "../cell.ts" ;
2
3
import { type Action } from "../scheduler.ts" ;
3
4
import { type ReactivityLog } from "../scheduler.ts" ;
4
- import { getCellLinkOrThrow } from "../query-result-proxy.ts" ;
5
+ import { getCellLinkOrValue } from "../query-result-proxy.ts" ;
6
+
5
7
export function ifElse (
6
8
inputsCell : DocImpl < [ any , any , any ] > ,
7
9
sendResult : ( result : any ) => void ,
@@ -15,9 +17,12 @@ export function ifElse(
15
17
return ( log : ReactivityLog ) => {
16
18
const condition = inputsCell . getAsQueryResult ( [ 0 ] , log ) ;
17
19
18
- const ref = getCellLinkOrThrow (
20
+ const current = getCellLinkOrValue (
19
21
inputsCell . getAsQueryResult ( [ condition ? 1 : 2 ] , log ) ,
20
22
) ;
21
- result . send ( ref . cell . getAtPath ( ref . path ) , log ) ;
23
+ const value = isCellLink ( current )
24
+ ? current . cell . getAtPath ( current . path )
25
+ : current ;
26
+ result . send ( value , log ) ;
22
27
} ;
23
28
}
You can’t perform that action at this time.
0 commit comments