react-native-batch-push icon indicating copy to clipboard operation
react-native-batch-push copied to clipboard

Wrong builder implementation on BatchUserEditor

Open Aure77 opened this issue 6 years ago • 0 comments

This is working, because each set* methods return a new BatchUserEditor and chaining is working.

BatchUser.editor()
    .setAttribute(("age", 26)
    .setDateAttribute("birthday", new Date('July 20, 69 00:20:18 GMT+00:00').getTime()) 
    .save(); // ok

But if I use a variable on editor instance for each set* methods, builder is not working as expected (nothing saved):

const batchUserEditor = BatchUser.editor();
batchUserEditor.setAttribute(("age", 26)
batchUserEditor.setDateAttribute("birthday", new Date('July 20, 69 00:20:18 GMT+00:00').getTime()) 
batchUserEditor.save(); // nothing is saved

set* methods should mutate batchUserEditor variable to let save correct values.

Aure77 avatar Jun 03 '20 14:06 Aure77