Remove classed func execution on empty data#136
Conversation
| nodeIcon: nodeIcon, | ||
| nodeGroup: nodeGroup, | ||
| showLabels: !nodeLabel.classed('hidden'), | ||
| showLabels: nodeLabel._groups[0].length > 0 ? !nodeLabel.classed('hidden') : null, |
There was a problem hiding this comment.
What is _groups? Does it always contain at least one element ([0])?
There was a problem hiding this comment.
_groups is a property of d3 object, which contains (in our case) only one list containing all labels to be generated in the graph. If the list is empty, we should not execute .classed() function on the object, which occures with the error. In my code I wanted to stick to this object and check if it contains any values to display.
We could also think about checking if nodes list is empty, but ... we don't have guarantee that both values are empty in the same time in any case (for example some library bugs in corner cases).
|
@k-jano I checked in my testbed and the issue is only partially gone. There is no error when only Note that there are |
|
I guess that is the expected behavior since alerts without a source are not displayed in the graph. @k-jano Please, confirm 😉 |
|
@bzurkowski Exactly, this is expected behaviour, because we describe alert namespace based on the namespace of a source. However this is an issue to solve. I think that you are right, there should be possibility to display only alert objects in the graph. I suggest to deliver this solution in separate PR, because:
|
|
Fully agree. I reported an issue to track the proposed enhancement (#139). Let's merge this PR! |

This PR resolves bug described in #134 and #135.
classed()func should not be executed on empty data.