This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
Create files on collapsed folders (#2085) #2198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a possible fix for #2085 by waiting on the
open_node.jstree
event before trying to create a new node.It looks like we're hitting a strange race condition in
jsquery.jstree.js
which appears when the node we want to open hasn't been loaded yet.In that case,
open_node
triggers aload_node
in line 640.Almost at the same time, a different
load_node
is triggered from the CRRMcreate
throughcreate_node
in line 734Not digging much further, if the second
load_node
gets called because the first one is not completed, thencreate_node
is not called again as expected and nothing gets created. This can be tested by adding a breakpoint in line 733. Doing that, the firstload_node
always finishes and the function completes ok.By waiting to the
open_node
event, we're making sure we always step intocreate_node
once the node is already loaded.UPDATE Just to confirm, the
load_node_json
call just returns without doing nothing if the node is already being loaded, which causes the callback tocreate_node
to get dropped without ever being called. Also, this check seems to have been removed in the v1.0 branch (https://github.com/vakata/jstree/blob/v.1.0/src/jstree.json.js)