Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for inaccurate bidrectional edges on edge hover #2342

Merged
merged 3 commits into from
Mar 20, 2017

Conversation

jpellizzari
Copy link
Contributor

Fix for #2341

Fixes a bug where bi-drectional arrows don't show up when mousing over the edge. Mousing over the node has always worked, but edge mouseover did not because only one edge is hover-able.

screenshot from 2017-03-16 21-23-13

@fbarl Could you review please?

@jpellizzari jpellizzari self-assigned this Mar 17, 2017
@jpellizzari jpellizzari requested a review from fbarl March 17, 2017 04:26
const opposite = action.edgeId.split(EDGE_ID_SEPARATOR).reverse().join(EDGE_ID_SEPARATOR);
highlightedEdgeIds = highlightedEdgeIds.add(opposite);
}
return highlightedEdgeIds;

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@jpellizzari
Copy link
Contributor Author

@fbarl Simplified with the approach you laid out.

@fbarl
Copy link
Contributor

fbarl commented Mar 17, 2017

Hmm okay so my original thought would be not to add a bunch of extra edges that are not bidirectional to the highlightedEdgeIds list. It would be confusing to someone looking at the state tree and seeing a bunch of edges that don't exist.

I absolutely agree the only proper way to do it would be not to include non-existent IDs there, but that's also something that could be done without bidirectionality information (if we intersect with the list of all edge IDs). That's what I plan to do in the next refactoring round by moving both highlightedEdgeIds and highlightedNodeIds into selectors. That will make this whole thing simpler :)

@fbarl
Copy link
Contributor

fbarl commented Mar 17, 2017

I just discovered an issue that hopefully didn't leave a big mark so far, but is relevant for this story. Having EDGE_ID_SEPARATOR set to a simple dash isn't the best policy as host IDs can contain dashes, so an example edge we get looks something like:

ip-172-20-2-209;<host>-ip-172-20-1-176;<host>

Then a big mess happens when split(EDGE_ID_SEPARATOR).reverse().join(EDGE_ID_SEPARATOR) is executed on such a string. :) That resulted in this PR fix having no effect when I tested it on the Hosts topology.

A simple solution would be to set EDGE_ID_SEPARATOR to something that we can be fairly sure is never gonna be a part of a node ID. Perhaps -----? :D

@jpellizzari
Copy link
Contributor Author

Nice catch! Updated the edge ID separator to several dashes

Copy link
Contributor

@fbarl fbarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Don't forget to (at least partially) squash the commits.

@jpellizzari jpellizzari force-pushed the 2341-bidrectional-bug branch from f48d086 to 7de074f Compare March 17, 2017 17:54
@jpellizzari jpellizzari force-pushed the 2341-bidrectional-bug branch from 7de074f to 451f6b2 Compare March 17, 2017 17:55
@jpellizzari jpellizzari force-pushed the 2341-bidrectional-bug branch from df2190d to c7f6a07 Compare March 20, 2017 00:31
@jpellizzari jpellizzari merged commit 923dfd3 into master Mar 20, 2017
@jpellizzari jpellizzari deleted the 2341-bidrectional-bug branch March 21, 2017 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants