tinybase icon indicating copy to clipboard operation
tinybase copied to clipboard

Default value in values schema is being sent as a write op to connected peers

Open jamesgpearce opened this issue 1 year ago • 1 comments

Discussed in https://github.com/tinyplex/tinybase/discussions/165

Originally posted by haggen July 28, 2024 So here's the situation; I have a typed store with a key x in Values, and I also am using a WebSocket synchronizer. Whenever a new client connects to the synchronizer server, the current value of x is overwritten with its default value.

I was expecting the new client to receive the latest value instead of zeroing it for everyone.

Is that by design or a bug?

jamesgpearce avatar Aug 02 '24 02:08 jamesgpearce

Having the same problem right now! The solution for me was removing the default field, and handle the 'undefined' case on the code I'll try to post a codepen reproducing the bug later

Joao620 avatar Jan 04 '25 14:01 Joao620