File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -638,23 +638,24 @@ const GlobalSection = ({
638638 try {
639639 const nextIsOpen = ! isOpen ;
640640 setIsOpen ( nextIsOpen ) ;
641- const markerText = getGlobalSectionFoldedMarkerText (
642- window . roamAlphaAPI . user . uid ( ) || "" ,
643- ) ;
644- if ( nextIsOpen ) {
645- const children = getBasicTreeByParentUid ( leftSidebarUid ) ;
646- await Promise . all (
647- children
648- . filter ( ( c ) => c . text === markerText )
649- . map ( ( c ) => deleteBlock ( c . uid ) ) ,
650- ) ;
651- } else {
652- await createBlock ( {
653- parentUid : leftSidebarUid ,
654- node : { text : markerText } ,
655- } ) ;
641+ const userUid = window . roamAlphaAPI . user . uid ( ) ;
642+ if ( userUid ) {
643+ const markerText = getGlobalSectionFoldedMarkerText ( userUid ) ;
644+ if ( nextIsOpen ) {
645+ const children = getBasicTreeByParentUid ( leftSidebarUid ) ;
646+ await Promise . all (
647+ children
648+ . filter ( ( c ) => c . text === markerText )
649+ . map ( ( c ) => deleteBlock ( c . uid ) ) ,
650+ ) ;
651+ } else {
652+ await createBlock ( {
653+ parentUid : leftSidebarUid ,
654+ node : { text : markerText } ,
655+ } ) ;
656+ }
657+ refreshConfigTree ( ) ;
656658 }
657- refreshConfigTree ( ) ;
658659 setPersonalSetting ( [ PERSONAL_KEYS . globalSectionFolded ] , ! nextIsOpen ) ;
659660 } finally {
660661 isTogglingRef . current = false ;
Original file line number Diff line number Diff line change @@ -317,12 +317,13 @@ export const getLeftSidebarSettings = (
317317 tree : leftSidebarChildren ,
318318 text : "Sidebar Migrated" ,
319319 } ) ;
320- const globalSectionFolded = getUidAndBooleanSetting ( {
321- tree : leftSidebarChildren ,
322- text : getGlobalSectionFoldedMarkerText (
323- window . roamAlphaAPI . user . uid ( ) || "" ,
324- ) ,
325- } ) ;
320+ const currentUserUid = window . roamAlphaAPI . user . uid ( ) ;
321+ const globalSectionFolded : BooleanSetting = currentUserUid
322+ ? getUidAndBooleanSetting ( {
323+ tree : leftSidebarChildren ,
324+ text : getGlobalSectionFoldedMarkerText ( currentUserUid ) ,
325+ } )
326+ : { uid : undefined , value : false } ;
326327 return {
327328 uid : leftSidebarUid ,
328329 favoritesMigrated,
You can’t perform that action at this time.
0 commit comments