-
Notifications
You must be signed in to change notification settings - Fork 127
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
Independent Editing #1349
Independent Editing #1349
Conversation
@raineorshine I have completed step 3 of migration. Please review the changes. Most of the changes are related to changing id to hashed context. |
One thing I noticed is that |
Yes, odd, but I agree we will be unifying them in the next step anyway. When you re-enable push/pull, make sure you're getting back the expected id from the databases and not some special database id. |
cda4032
to
5ea8362
Compare
@raineorshine Please review the changes. Now, |
5ea8362
to
ffe8fee
Compare
8984ee3
to
10d9224
Compare
unify Parent.id, Child.id and ThoughtContext.id as hash of the context skip id dependent tests disable pull push and context view and related tests
change hashContext and related functions to return uuid by tree travesal
siable use of getDescendant thoughts
fix related tests
cbafe52
to
78122b3
Compare
@shresthabijay Hey Bijay! We discussed your status of this briefly in our meeting, but I find it helpful to also maintain a written record. Please post a written update when you get a chance. Here are two questions to frame your response:
|
@raineorshine I am currently on step 8 and I have skipped step 7. I have updated the progress on the comment above. #1349 (comment). I am currently making tests work. Due to change in |
@raineorshine What are your thoughts on this ? |
Temporaily exclude native files from ts
@raineorshine I have started to enable push and pull. After that, we need to do the optimizations. I will list some of them that I have on top of my head.
|
I would agree with the suggested optimizations. Once everything is functional, we should get the PR merged before optimizing. There are a few more things that need to be done before we move to optimization:
Am I missing anything? |
That pretty much sums it. I am working on these. |
Sure. |
@raineorshine I ran into some issues while re-enabling
If you are okay with these, I will make the changes. |
Good in theory, but I don't think more than one trip to IndexedDB is acceptable performance on startup.
The |
Sure I will do that. |
That's much better thanks. I will implement it. |
remove flush edits and moves fix related tests
@raineorshine Are the changes intended to be pushed before the flush pending, moves, and edits mechanism can force pull the related data? |
Which changes exactly? When an edit is made? With the new implementation, since edits and moves are O(1), I don't believe that we have to worry about pending thoughts. All of the That is, unless you are referring to the descendant merging logic? I think that needs to be rethought. There are too many things that can go wrong with non-atomic changes to multiple thoughts. |
Yes from edit, move, delete etc. I noticed that when deleting the context with pending children there was some inconsistency for a while. When a buffered thought is deleted.
After So we don't have So This will not be the problem after the latest commit. But I thought it was important to mention this issue. I wonder if similar issue is the reason for data integrity problems in the current implementation. |
Deletes are recursive. Edits and moves are not recursive any more. They're O(1). Unless you're considering the handling of merging descendants, but you didn't specify that. I don't think you can group edits, moves, and deletes into one category any more.
Yes, it's an unfortunate aspect of the implementation in em/src/redux-middleware/pushQueue.ts Lines 150 to 154 in d10454c
That makes sense. I may have missed that timing consideration. At the very least, it is inefficient, but it also creates additional opportunities for data inconsistencies.
That's good! Yes, very well could be. So how does the latest commit solve this? |
reenable updateURLHistory
fix other tests
Change ThoughtContext to be same as ThoughtId
refactor expand thoughts to return index of paths instead of index of context
I am getting an error on a fresh load: At |
Also getting At |
Fixes #495
Changes
Step 1 - 3
Child.id
andThoughtContext.id
required.Parent.id
andParent.value
required.Parent.id
,Child.id
andThoughtContext.id
, where id is the hashed context instead of UUID. Mostly usinghashContext
to generate an id wherePath
andLexeme
are created or updated.Step 4
Parent.id
to UUID and persist it on thought updates.hashContext
to traverse the thought tree and return parent UUID.Parent
entry for everyChild
. If there is a child then it should have a parent entry too.Notes:
moveThought
is broken. All the affected tests have been skipped.Step 5
Parent
making it similar to Doubly Linked List. Now it is possible to traverse in both directions of the thought tree.context
fromParent
andThoughtContext
.Notes:
context
instead ofid
has not been changed. For now, some utility functions likegetContextsForThought
have been added to generatecontext
from the thoughtid
so that these functions can work. These api's will change in later steps.Step 6
editThought
andmoveThought
.contextView
related logic ineditThought
andmoveThought
because it will possibly implemented in a different way.Notes:
deleteThought
still has recursive updates because we always have to remove all the descendant thoughts from the persistence layer. We possibly need to do the recursive deletion separately outside this reducer. Open to discussion.Step 7 (Skipped)
Step 8 / Step 9
Change
Path
to an array of ids,Child
to id, andThoughtContext
to id. Addrank
andarchived
toParent
.Lexeme.contexts
now stores the actual thought id instead of its parent id. The reason is we want to access both the actual thought and its parent on 0(1). If we just store parent id, we can access the parent on 0(1) using the parent id in theLexeme.contexts
but to find the actual thought we need to iterate the children array. If we store the actual thought id, we can easily access the parent on O(1) too because thought has a direct backlink to its parent.Add
newRank
to themoveThought
sincePath
doesn't include rank anymore.Removed use of context views logic where required.
Kept most of the API's of the functions intact. Some have been changed like
removeContext
which uses id instead of context.Added
getContextForThought
which givescontext
from the given thought id.Changed
pathToContext
to selector which takes a path and returns the context.Changed most of the
getChildren
functions to return thoughts instead of just ids.Disabled recently edited and URL update tests.
Fixed all remaining tests.
Changes after review of Step 8 / Step 9
hashContext
in tests.tsconfig
temporarily.Step 7 (Renable push and pull)
getContext
data helper now usesrankThoughtsFirstMatch
logic to get the parent entry from the persistance layer.orphaned
param to thedeleteThought
payload that will ignore all the parent's children update logic. I have added proper comments for now. This may need to refactored later on.flushMoves
andflushEdits
🎉Step 10.
Remaining Steps
hashContext
to getThoughtIdByContext`Child
to brandedThoughId