question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing a value of an item inside an ArraySchema is not sent to the client

See original GitHub issue

Trying to change the value of an item inside an ArraySchema changes the state correctly, but the client doesn’t get the change in the onStateChange listener.

execute({ sessionId, cardIndex }: this['payload']) {
    const player = this.state.players[sessionId] as Models.Player;
    player.hand.cards[cardIndex].isSelected = true;
    console.log(player.hand.cards[cardIndex].isSelected); //true as expected, still false in client
  }

I tried both with and without filters on version 0.14.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DimosthenisKcommented, Oct 19, 2020

Problem was indeed solved by migrating to 0.14!

1reaction
DimosthenisKcommented, Oct 19, 2020

That’s awesome. Thank you!

I’ll go ahead and try migrating again if it is going to be released so soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongoose, update values in array of objects - Stack Overflow
Problem with this approach is that it updates/sets the entire object, therefore in this case I lose the id field. Is there a...
Read more >
Schema - Colyseus & Arena Cloud Documentation
Returns a boolean value wheter an item exists in the Collection or not. if (set.has("two")) { console.log ...
Read more >
ArraySchema annotation on model accessors doesn't map to ...
I'm using swagger-core 2.0.0 with Jackson 2.9.4 and Jersey 2.26. I'll start that I'm learning-by-doing, and so it's possible I'm doing it ...
Read more >
@colyseus/schema - npm
@colyseus/schema encodes only field values in the specified order. Both encoder (server) and decoder (client) must have same schema definition.
Read more >
Understanding JSON Schema
Most of the work of writing a JSON Schema involves mapping a special “keyword” to a value within an object. For example, in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found