This is causing problems for instance in the Tasks recurrence code. When I handle completing a recurring task, I need to use copy to create the next occurrence, modify it, and save it. Since the underlying jCal objects for both tasks are really just the same object, anything I modify on the "clone" is modified on the original (only in memory, until I inevitably save them).
The
clone
function uses ical'stoJson
function to make a copy. Unfortunately, this function just returns the object representation of a component, it doesn't actually make a json copy as one would expect. This is dangerous: as the documentation says, "The returned object is a live jCal object and should be cloned if modified".This is causing problems for instance in the Tasks recurrence code. When I handle completing a recurring task, I need to use
copy
to create the next occurrence, modify it, and save it. Since the underlying jCal objects for both tasks are really just the same object, anything I modify on the "clone" is modified on the original (only in memory, until I inevitably save them).