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.
fixes #2721, is ad-hoc fix, needs a deeper think to be not-ad-hoc
it was
onFocus
of a newly created note that triggered an incorrect dispatch ofsetCursor
:the problem was:
simplifyPath
would return an empty array at times like this.The and we'd get
simplifyPath(state, path) || path) =
[] || path=
[]` , so the fallback never really worked 😄After putting a more elaborate condition, and using
path
as a fallback, we get broken editor behavior: the part of the tree collapses(we go to a wrongpath
)In the end, when I just did not allow
[]
paths, it fixed the thing. And the app, from my manual tests, works just fine. The cursor is there, everything is smooth.setDescendant
action puts the appropriate state, from what I observed.and on the reasons why we even get to the case of
simplifyPath
returning[]
here, I'm not really sure, and feels like, we should dig there, if we want more than just a ad-hoc bug fix.