You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have no problem with higher order libraries and/or wrappers that create new abstractions or syntactic sugar on top of existing libraries. This is what react-sigma does on many sides, that makes me happily use it in my React applications.
However, on that very decision, I think it's a design mistake: react-sigma provides both useSetSettings to manage sigma's settings, and useRegisterEvents to handle events, and as a developer, I do not expect useRegisterEvents to affect settings.
I understand this decision is made because you thought it makes no sense to listen to edge events while having edge interactions disabled in the settings. Here are some precise issues I have with this situation:
I could use the settings to toggle edge interaction in an app, without wanting to change my event listeners. Sigma allows it, so I would expect react-sigma to work the same way, and it would be hard to find where the issue is (this is a similar situation to what led me to write this ticket in the first place)
The way it's done allows many bugs to occur. One example:
1. I bind a listener on edge events while settings are set to false
2. I set the settings to true right after
3. I unbind the events later
4. At this point, the settings are back to false, while my code set them to true at some point (and I wouldn't expect them to be different)
Same issue, with specifically enableEdgeHoverEvents set to "debounce"
I see 3 main ways to fix this issue:
If you think it makes no sense to allow binding listeners to edge events while edge interaction settings are false, maybe sigma is wrong and we could address that directly in sigma
If you still want to prevent your users from falling into that issue, you could clarify the situation, by creating a new react-sigma concept, that would take care both of sigma events and settings (useEdgeEvents, for example).
Finally, you could want to keep the APIs as close to sigma's as possible, but still educate your users on these kind of potential mistakes. For instance, you could use console.warn when some code tries to listen to edge events while the edge settings are false
The text was updated successfully, but these errors were encountered:
I have had some trouble with the following code:
react-sigma/project/packages/core/src/hooks/useRegisterEvents.ts
Lines 83 to 103 in 9b55729
I have no problem with higher order libraries and/or wrappers that create new abstractions or syntactic sugar on top of existing libraries. This is what
react-sigma
does on many sides, that makes me happily use it in my React applications.However, on that very decision, I think it's a design mistake:
react-sigma
provides bothuseSetSettings
to manage sigma's settings, anduseRegisterEvents
to handle events, and as a developer, I do not expectuseRegisterEvents
to affect settings.I understand this decision is made because you thought it makes no sense to listen to edge events while having edge interactions disabled in the settings. Here are some precise issues I have with this situation:
1. I bind a listener on edge events while settings are set to
false
2. I set the settings to
true
right after3. I unbind the events later
4. At this point, the settings are back to
false
, while my code set them totrue
at some point (and I wouldn't expect them to be different)enableEdgeHoverEvents
set to"debounce"
I see 3 main ways to fix this issue:
react-sigma
concept, that would take care both ofsigma
events and settings (useEdgeEvents
, for example).console.warn
when some code tries to listen to edge events while the edge settings arefalse
The text was updated successfully, but these errors were encountered: