@@ -1248,6 +1248,7 @@ class NetJSONGraphUtil {
12481248 }
12491249
12501250 addActionToUrl ( self , params ) {
1251+ console . log ( params ) ;
12511252 if ( ! self . config . bookmarkableActions . enabled || params . data . cluster ) {
12521253 return ;
12531254 }
@@ -1267,9 +1268,12 @@ class NetJSONGraphUtil {
12671268 fragments [ id ] = new URLSearchParams ( ) ;
12681269 fragments [ id ] . set ( "id" , id ) ;
12691270 }
1270- fragments [ id ] . set ( "nodeId" , nodeId ) ;
1271- const state = self . indexedNode [ nodeId ] ;
1272- this . updateUrlFragments ( fragments , state ) ;
1271+ // Sync nodeId to URL only if defined, prevents pushing empty states in case of links
1272+ if ( nodeId ) {
1273+ fragments [ id ] . set ( "nodeId" , nodeId ) ;
1274+ const state = self . indexedNode [ nodeId ] ;
1275+ this . updateUrlFragments ( fragments , state ) ;
1276+ }
12731277 }
12741278
12751279 removeUrlFragment ( id ) {
@@ -1313,8 +1317,10 @@ class NetJSONGraphUtil {
13131317 const { location, cluster} = node ;
13141318 if ( [ "scatter" , "effectScatter" ] . includes ( nodeType ) ) {
13151319 const zoom =
1316- cluster != null ? self . config . disableClusteringAtLevel : self . leaflet . getZoom ( ) ;
1317- self . leaflet . setView ( [ location . lat , location . lng ] , zoom ) ;
1320+ cluster != null
1321+ ? self . config . disableClusteringAtLevel
1322+ : self . leaflet ?. getZoom ( ) ;
1323+ self . leaflet ?. setView ( [ location . lat , location . lng ] , zoom ) ;
13181324 }
13191325 self . config . onClickElement . call ( self , "node" , node ) ;
13201326 }
0 commit comments