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

delete tree if delete node is initiated for an empty tree #2806

Merged
merged 8 commits into from
Jun 28, 2018

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Jun 26, 2018

Mailable description of changes:

  • When deleting the last node of a tree, that tree will not be removed automatically anymore. Instead, the tree will just be empty. To remove that active tree, the "delete" shortcut can be used again.

URL of deployed dev instance (used for testing):

Steps to test:

  • create a new tree and delete it with del again
  • test normal delete node functionality

Issues:


  • Ready for review

@philippotto
Copy link
Member Author

@daniel-wer Should be ready for final review :)

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

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

LGTM, very nice, works as described. I like that we got rid of the deleteTree side effect :)

.apply(SkeletonTracingReducer, deleteNodeAction)
.unpack();

t.deepEqual(
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't t.deepEqual(emptyTreeState, newState) be true here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately not :( The DiffableMap node collection creates an internal chunk when nodes are added, which is not removed again (it's just emptied). That's why the states differ. Ideally, the equal method would not compare the internal state of the DiffableMap, but I don't know how we can achieve this consistently without doing magic in an own compare-function..

Copy link
Member

Choose a reason for hiding this comment

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

I see, no big deal.

@@ -394,3 +369,36 @@ export const setTreeGroupAction = (groupId: ?string, treeId: number): SetTreeGro
groupId,
treeId,
});

// The following actions have the prefix "AsUser" which means that they
Copy link
Member

Choose a reason for hiding this comment

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

Nice, do you think moving the deleteTreeWithConfirmAction here as well would be sensible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good point, I'll do that!

@philippotto philippotto added this to the Sprint 24a milestone Jun 28, 2018
@philippotto philippotto merged commit ddcfd82 into master Jun 28, 2018
@normanrz normanrz deleted the delete-empty-tree-with-del branch July 2, 2018 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants