triplit
triplit copied to clipboard
Can't update set from null to empty
If a set is undefined, it's not possible to assign an empty set.
Doesn't work. my_set is still null after the update.
triplit.http.update('my_table', row => {
// row.my_set is null
row.my_set= new Set()
}
Works. my_set is an empty set after the update.
triplit.http.update('my_table', row => {
// row.my_set is null
row.my_field = new Set()
section.my_set.add('__TRIGGER__')
section.my_set.delete('__TRIGGER__')
})
can you share the client version you are using, and if you are using local development or a cloud server?
I tried to recreate the issue, but I was seeing expected results
// client = HttpClient
await client.insert('test', {
id: 'test1',
name: 'a',
});
await client.update('test', 'test1', (entity) => {
entity.name = 'b';
entity.items = new Set(['item']);
});
const result = await client.fetchById('test', 'test1');
expect(result).toEqual({
id: 'test1',
name: 'b',
items: new Set(['item']),
});