-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
…lity into 'userAction' instead of reducer
@daniel-wer Should be ready for final review :) |
There was a problem hiding this 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( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
Mailable description of changes:
URL of deployed dev instance (used for testing):
Steps to test:
Issues: