If I have a state like this:

@type([Simple]) exampleObjArray = new ArraySchema<Simple>();
@type(Simple) lastOneAdded: Simple;

export class Simple extends Schema {
  constructor(name: string) {
    super();
    this.name = name;
  }
  @type('string') name: string;
}

And then modify the state to add one to the array:

const s = new Simple('simple');
state.exampleObjArray.push(s);
state.lastOneAdded = s;

And then do it again later...

const s = new Simple('simple');
state.exampleObjArray.push(s);
state.lastOneAdded = s;

And then I delete from the array:

state.exampleObjArray.pop();

and then delete again...

state.exampleObjArray.pop();

And then I change lastOneAdded:

state.lastOneAdded.name = 'Changed.';

On the client:

room.onStateChange(s => console.log(s));

s.name remains 'simple' when I would expect 'Changed'
When I reload the whole page, the state s.name is set to 'Changed'

Should this kind of data schema be avoided? It would be nice to have data duplicated in the schema, but this seems to be leading to the problem. Is this actually a bug? Or do I just have to make sure not to have data share references?

I noticed a similar problem when deleting from a MapSchema.