Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArraySchema: moving items results in wrong state #108

Open
pkamilp opened this issue May 6, 2021 · 1 comment
Open

ArraySchema: moving items results in wrong state #108

pkamilp opened this issue May 6, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@pkamilp
Copy link

pkamilp commented May 6, 2021

Code to reproduce

import { ArraySchema } from '@colyseus/schema';

const deckCards: ArraySchema<number> = new ArraySchema<number>();

deckCards.push(1);
deckCards.push(2);

deckCards.shift();
deckCards.unshift(3);

deckCards.at(0); // should be 3
endel added a commit that referenced this issue Jun 1, 2021
endel added a commit that referenced this issue Jun 1, 2021
@endel endel added the bug Something isn't working label Jun 1, 2021
@endel
Copy link
Member

endel commented Jun 1, 2021

Thanks for reporting @pkamilp, I can confirm this is a problem. The client-side seems to decode this operation properly (deckCards[0] does contain the value 3), but the server-side has the wrong index.

This is yet another issue that makes me think arrays should be synchronized and treated completely differently than it currently is. Let's leave this issue open until we have a plan of action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants