File tree Expand file tree Collapse file tree
apps/roam/src/components/settings/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,12 +95,18 @@ const booleanWithDefault = (defaultVal: boolean) =>
9595 . optional ( )
9696 . transform ( ( val ) => val ?? defaultVal ) ;
9797
98- const defaultNodeIndexValue = {
99- conditions : [ ] ,
100- selections : [ ] ,
98+ const defaultNodeIndex = ( ) => ( {
99+ conditions : [ ] as {
100+ type : string ;
101+ relation : string ;
102+ source : string ;
103+ uid : string ;
104+ not : boolean ;
105+ } [ ] ,
106+ selections : [ ] as { text : string ; label : string } [ ] ,
101107 custom : "" ,
102108 returnNode : "node" ,
103- } ;
109+ } ) ;
104110
105111export const DiscourseNodeSchema = z . object ( {
106112 text : z . string ( ) ,
@@ -116,7 +122,9 @@ export const DiscourseNodeSchema = z.object({
116122 } )
117123 . nullable ( )
118124 . optional ( )
119- . transform ( ( val ) => val ?? { enabled : false , query : defaultNodeIndexValue } ) ,
125+ . transform (
126+ ( val ) => val ?? { enabled : false , query : defaultNodeIndex ( ) } ,
127+ ) ,
120128 template : z
121129 . array ( RoamNodeSchema )
122130 . nullable ( )
@@ -130,7 +138,9 @@ export const DiscourseNodeSchema = z.object({
130138 . optional ( )
131139 . transform ( ( val ) => val ?? { } ) ,
132140 overlay : stringWithDefault ( "" ) ,
133- index : IndexSchema . nullable ( ) . optional ( ) . transform ( ( val ) => val ?? defaultNodeIndexValue ) ,
141+ index : IndexSchema . nullable ( )
142+ . optional ( )
143+ . transform ( ( val ) => val ?? defaultNodeIndex ( ) ) ,
134144 suggestiveRules : SuggestiveRulesSchema . default ( { } ) ,
135145 backedBy : z
136146 . enum ( [ "user" , "default" , "relation" ] )
You can’t perform that action at this time.
0 commit comments