You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caused by #15's merge logic for persisted chapters.
The logic has 2 issues:
The lists are in chronological, not reverse chronological. Index 0 of the new list may be 1 chapter ahead of index 0 of the old, i.e. old[0] === new[1] (or later index). Should be checking that the identifier, link, is the same for each chapter that's merged
MST throws an error when trying to merge in a node that already exists in the tree, this is what's actually causing new chapters to not show up. This error is swallowed, but it means the whole array of new chapters isn't processed as it'll error out on the very first element (this took a bit of time to debug and find due to the swallowing). Instead of updating each chapter in the list as we go, we should probably just create a new list and then update the whole thing in one go.
The optimal solution to this is probably to create a map of each chapter and then have a list that's just refs in chronological order. This would be like we have with the mangasmap. That way we can just O(1) update each entry in the map and then just create a new ref list from the new chapters. Unfortunately, that would totally break the currently persisted data, so we either need to implement versioning support in mst-persist or do some similar type of workaround for versioning.
The text was updated successfully, but these errors were encountered:
Caused by #15's merge logic for persisted chapters.
The logic has 2 issues:
old[0] === new[1]
(or later index). Should be checking that the identifier,link
, is the same for each chapter that's mergedThe optimal solution to this is probably to create a
map
of each chapter and then have a list that's just refs in chronological order. This would be like we have with themangas
map. That way we can just O(1) update each entry in the map and then just create a new ref list from the new chapters. Unfortunately, that would totally break the currently persisted data, so we either need to implement versioning support inmst-persist
or do some similar type of workaround for versioning.The text was updated successfully, but these errors were encountered: