mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-25 06:02:14 -06:00
[GH-ISSUE #4] Change tracking improvement #5
Labels
No labels
IndexedDB
browser
bug
dependencies
documentation
duplicate
enhancement
feature request
indexes
indexes
invalid
pull-request
query
question
transaction logging
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @appy-one on GitHub (Jan 29, 2021).
Original GitHub issue: https://github.com/appy-one/acebase/issues/4
Originally assigned to: @appy-one on GitHub.
The code that does change tracking currently clones the entire previous stored value to prepare previous/new values to trigger change events and index updates with. Because change events might be on higher paths than the data being updated, cloning the data costs memory and cpu, while most of it isn't even changed. Even worse, it also does this when target data is being deleted. It would be better to create shallow copies of the original data (new objects whose properties point to the existing in-memory child objects), and recursively shallow copy the data up to the path being changed, only changing that data. Tracking changes this way is also faster because most properties will point to the same data as the previous value's properties, eliminating the need to traverse the tree to find changes - they'll point to the same data:
previous.someObject === current.someObject@appy-one commented on GitHub (Feb 1, 2021):
Implemented in v1.0.2