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 graph issue when deleting node #401

Merged
merged 6 commits into from
Dec 9, 2020
Merged

Conversation

riccardoferretti
Copy link
Collaborator

Fix #397, graph freezing when removing a node.

The problem was that the selectedNodes included the deleted graph (if the user deletes it when coming from the document window, which set the selection to the document on focus).

Two main changes:

  • filter hoverNode and selectedNodes to make sure they don't include removed notes
  • added an error handler to see in the Foam log any unhandled error coming from the webview (to help with possible future bugs)

Also added a minor style change to the graph for better readibility.

Unfortunately right now it's not easy to add tests for the webview, this would be addressed when making it its own module.

@riccardoferretti riccardoferretti added the foam-dataviz Related to data visualization label Dec 9, 2020
Copy link
Member

@ingalless ingalless left a comment

Choose a reason for hiding this comment

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

Small nitpick, but happy for this be merged without!

packages/foam-core/tsconfig.json Outdated Show resolved Hide resolved
@@ -27,7 +27,7 @@ const style = {
const sizeScale = d3
.scaleLinear()
.domain([0, 30])
.range([1, 3])
.range([0.5, 2])
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick for the future, changes like these add noise to the original PR
I also suffer from this but I think we can all each other get better

@riccardoferretti riccardoferretti merged commit 2135903 into master Dec 9, 2020
@riccardoferretti riccardoferretti deleted the fix/397-graph-freeze branch December 9, 2020 18:33
m.selectedNodes = new Set(
Array.from(m.selectedNodes).filter(nId => remaining.has(nId))
);

Copy link
Contributor

Choose a reason for hiding this comment

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

I rebased my branch for #394 on top of this -- I'm noticing that when I save a file the graph loses track of which node is selected / being hovered over. Could that be related to my change of not deleting the node anymore on save?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just reproduced this on master, so it's unrelated to your changes - I am investigating what's causing this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if you rebase from master the issue is now fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
foam-dataviz Related to data visualization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graph "freezes" when deleting node that links to file that doesn't exist
4 participants