@@ -742,7 +742,7 @@ document.addEventListener('DOMContentLoaded', function() {
742742 if ( namespaceFilters . length === 0 ) return true ;
743743
744744 // Get the first level of the namespace from the nodeId
745- const firstLevelNamespace = nodeId . split ( '.' ) [ 0 ] ;
745+ const firstLevelNamespace = getFirstLevelNamespace ( nodeId ) ;
746746
747747 // Check if this first level namespace is in the list of filtered namespaces
748748 return namespaceFilters . includes ( firstLevelNamespace ) ;
@@ -1137,6 +1137,13 @@ document.addEventListener('DOMContentLoaded', function() {
11371137 d3 . select ( event . currentTarget ) . classed ( 'hover' , false ) ;
11381138 }
11391139
1140+ // Function to extract the first level namespace from a full node ID
1141+ function getFirstLevelNamespace ( nodeId ) {
1142+ if ( ! nodeId ) return '' ;
1143+ const parts = nodeId . split ( '.' ) ;
1144+ return parts [ 0 ] || '' ;
1145+ }
1146+
11401147 // Initialize filters based on the graph data
11411148 function initializeFilters ( ) {
11421149 console . log ( "Initializing filters..." ) ;
@@ -1153,18 +1160,8 @@ document.addEventListener('DOMContentLoaded', function() {
11531160
11541161 // Process each node to extract just the first level of namespaces
11551162 graph . nodes . forEach ( node => {
1156- let firstLevelNamespace = null ;
1157-
1158- if ( node . group === 'namespace' ) {
1159- // For namespace nodes, get only the first part
1160- firstLevelNamespace = node . id . split ( '.' ) [ 0 ] ;
1161- } else {
1162- // For other nodes, extract the first part of the namespace
1163- const parts = node . id . split ( '.' ) ;
1164- if ( parts . length > 1 ) {
1165- firstLevelNamespace = parts [ 0 ] ;
1166- }
1167- }
1163+ // Get the first part of the namespace for every node
1164+ const firstLevelNamespace = getFirstLevelNamespace ( node . id ) ;
11681165
11691166 // Add to set if valid
11701167 if ( firstLevelNamespace ) {
0 commit comments