@@ -28,36 +28,29 @@ export const formatHexColor = (color: string) => {
2828
2929const DiscourseNodeCanvasSettings = ( { nodeType } : { nodeType : string } ) => {
3030 const [ color , setColor ] = useState < string > ( ( ) => {
31- const storedColor =
32- getDiscourseNodeSetting < string > ( nodeType , [ "canvasSettings" , "color" ] ) ??
33- "" ;
31+ const storedColor = getDiscourseNodeSetting < string > ( nodeType , [
32+ "canvasSettings" ,
33+ "color" ,
34+ ] ) ! ;
3435 return formatHexColor ( storedColor ) ;
3536 } ) ;
36- const [ alias , setAlias ] = useState < string > (
37- ( ) =>
38- getDiscourseNodeSetting < string > ( nodeType , [ "canvasSettings" , "alias" ] ) ??
39- "" ,
37+ const [ alias , setAlias ] = useState < string > ( ( ) =>
38+ getDiscourseNodeSetting < string > ( nodeType , [ "canvasSettings" , "alias" ] ) ! ,
39+ ) ;
40+ const [ queryBuilderAlias , setQueryBuilderAlias ] = useState < string > ( ( ) =>
41+ getDiscourseNodeSetting < string > ( nodeType , [
42+ "canvasSettings" ,
43+ "query-builder-alias" ,
44+ ] ) ! ,
4045 ) ;
41- const [ queryBuilderAlias , setQueryBuilderAlias ] = useState < string > (
42- ( ) =>
43- getDiscourseNodeSetting < string > ( nodeType , [
44- "canvasSettings" ,
45- "query-builder-alias" ,
46- ] ) ?? "" ,
46+ const [ isKeyImage , setIsKeyImage ] = useState ( ( ) =>
47+ getDiscourseNodeSetting < boolean > ( nodeType , [ "canvasSettings" , "key-image" ] ) ! ,
4748 ) ;
48- const [ isKeyImage , setIsKeyImage ] = useState ( ( ) => {
49- const value = getDiscourseNodeSetting < boolean > ( nodeType , [
49+ const [ keyImageOption , setKeyImageOption ] = useState ( ( ) =>
50+ getDiscourseNodeSetting < string > ( nodeType , [
5051 "canvasSettings" ,
51- "key-image" ,
52- ] ) ;
53- return value === true ;
54- } ) ;
55- const [ keyImageOption , setKeyImageOption ] = useState (
56- ( ) =>
57- getDiscourseNodeSetting < string > ( nodeType , [
58- "canvasSettings" ,
59- "key-image-option" ,
60- ] ) ?? "first-image" ,
52+ "key-image-option" ,
53+ ] ) ! ,
6154 ) ;
6255
6356 return (
0 commit comments