Skip to content

Updating Categories with duplicate names changes both #702

@jyeoh5

Description

@jyeoh5
  • I am on the latest ActivityWatch version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • OS name and version: Linux Mint 22.1 Cinnamon
  • ActivityWatch version: v0.13.2

Describe the bug

It seems like updating the name or adding a subcategory of a category updates all categories that have the same name "path".

This is especially evident when making multiple new categories (which all have default name "New Class") and tying to update one of them.

To Reproduce

  1. In the settings page add 2 new subcategories with the default "New class" name
  2. Edit one of the categories' names and observe both names change
  3. Add a new subcategory to one of them and it gets added to both

Expected behavior

Only the selected category changes

Documentation

Additional context

I believe the renaming issue has something to do with this section:

// When a parent category is renamed, we also need to rename the children
_.map(this.classes, c => {
if (_.isEqual(old_name, c.name.slice(0, parent_depth))) {
c.name = new_class.name.concat(c.name.slice(parent_depth));
console.log('Renamed child:', c.name);
}
});

Not too sure of the cause of the adding subcategory issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions