Skip to content
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

Setter not triggered on removing a watching attribute #395

Open
jw-meta opened this issue Jun 18, 2024 · 1 comment
Open

Setter not triggered on removing a watching attribute #395

jw-meta opened this issue Jun 18, 2024 · 1 comment

Comments

@jw-meta
Copy link

jw-meta commented Jun 18, 2024

Describe the bug
with attribute updatedAt having property watch: ['status']
the attribute updatedAt setter is not triggered when patch.remove() is called to remove the attribute status

it works as expected when watch: '*' is set

ElectroDB Version
2.13.1

ElectroDB Playground Link
config with watch as array of attribute names
config with watch as wildcard

Entity/Service Definitions

{
  model: {
    entity: "tasks",
      version: "1",
        service: "taskapp"
  },
  attributes: {
    id: {
      type: "string",
        required: true
    },
    status: {
      type: 'string'
    },
    createdAt: {
      type: "number",
        default: () => Date.now(),
        readOnly: true
    },
    updatedAt: {
      type: "number",
        watch: ['status'],
          set: () => Date.now(),
            readOnly: true
    }
  },
  indexes: {
    projects: {
      pk: {
        field: "pk",
          composite: ["id"]
      },
    },
  }
}

Expected behavior
The setter of updated_at should be triggered on removing status attribute with patch.remove()

@tywalch
Copy link
Owner

tywalch commented Jul 4, 2024

Thank you, I will look into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants