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
Describe the bug
I'd expect an attribute to adhere to the field property at all times - whether or not it's a computed attribute. However, computed attributes seem to ignore the field property during an update operation when their update is triggered from another attribute being set.
import{Entity}from"electrodb";consttasks=newEntity({model: {entity: "tasks",version: "1",service: "taskapp",},attributes: {id: {type: "string"},expiresAt: {type: "string",default: ()=>newDate().toISOString()},localFieldName: {type: "number",field: "TTL",// This should be used when updatingwatch: ["expiresAt"],set: (_,{ expiresAt })=>Date.parse(expiresAt),},},indexes: {byId: {pk: {field: "PK",composite: ["id"]},sk: {field: "SK",composite: []},},},},{table: "taskapp"},);tasks.create({id: "test"}).go();// Updating `expiredAt` triggers an update of `localFieldName`, which itself// should be saved as `TTL` based on the `field` attribute, but it's saved as// `localFieldName` to dynamodbtasks.update({id: "test"}).set({expiresAt: newDate().toISOString()}).go();
The text was updated successfully, but these errors were encountered:
sam3d
changed the title
Watched attributes ignore field property update
Computed attributes ignore field property during update
Aug 19, 2023
Describe the bug
I'd expect an attribute to adhere to the
field
property at all times - whether or not it's a computed attribute. However, computed attributes seem to ignore thefield
property during an update operation when their update is triggered from another attribute being set.ElectroDB Version
2.8.0
ElectroDB Playground Link
https://electrodb.fun/?#code/JYWwDg9gTgLgB...
Entity/Service Definitions
The text was updated successfully, but these errors were encountered: