-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix: Preserve root node block refs when cutting + pasting. #10841
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
Conversation
Sorry. I cannot reproduce the original bug. Screen.Recording.2024-01-11.at.4.03.13.PM.movThe above is my steps to reproduce the behavior. Am I missing something? |
Thanks for taking a look! Screen.Recording.2024-01-11.at.10.21.43.mov |
Here are some details on the other problem: Screen.Recording.2024-01-14.at.11.49.513.movAfter the cut the |
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
Thanks. It would probably be also good to address the problem of the stale I found the problem with the references to old
For example there is |
I updated the PR to not include references to non-existing Let me know if this solution works. I don't have a good enough overview of the code base to know whether this would break something else. If there's another test case I should try also let me know. |
Here's the behavior after the changes:
Screen.Recording.2024-01-18.at.08.31.28420.mov |
Should we merge this or is there anything else missing? |
This is an attempt at a fix. There may be a better way to do this. When cutting + pasting the root node's references are not preserved. The problem is that the root-block returned by
db/pull
misses the:block/_refs
while blocks returned bydb/get-block-and-children
contain:block/_refs
. I know too little about the inner workings for Logseq and Datascript to know if this is expected. If someone could let me know whether or not this is expected or whether there is a way to modifydb/pull
to return:block/_refs
that would be great.More details can be found in this issue: #4491