Skip to content

Why is a client.subscribe callback being called twice? #1000

Answered by delucis
rriesebos asked this question in Q&A
Discussion options

You must be logged in to vote

Your intuition is correct. Even with client: false the client itself still runs some logic, at least as far as to discover that move is disabled on the client. Then — even if the state hasn’t changed — it calls the subscriber callbacks. So, as you suspected, the client making the move has its callbacks called twice: once from the local “optimistic” update (even if it didn’t actually produce a state change), and then again when the remote update arrives.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by delucis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #998 on August 30, 2021 19:12.