reset store without reconnecting socket #898
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
partial attempt at #877.
liwords-socket
needs the path to know which realms to subscribe to. if the path changes, the socket must be killed and reconnected.on closer inspection, it seems only paths starting with
/game/
,/tournament/
, or/club/
need to be preserved.this PR
LiwordsSocket
to betweenLoginStateStore
andRestOfStore
.RestOfStore
, so that in itself this does not cause socket reconnection.path
fromLoginStateStore
. it's only used inTournamentRoom
and is currently always equal to the path returned byreact-router-dom
anyway. also removesisChild
, which is unused. (there is a no-op cast instore/login_state.ts
that seems to not prevent injection of such additional keys during the object spread.)/game/
,/tournament/
, or/club/
to/
. so, there's no reconnection when people go from/
to/profile
to/settings
to/team
or something like that. (of course it's not very useful if the main load is from rematch redirects.)expect even more bugs. test thoroughly and be ready to revert.
obviously, this PR introduces a new bug: socket messages received by the old handler will be processed by the old rest of store, and socket messages received by the new handler will be processed by the new rest of store after reset. (there's also a brief period of time when neither handler is installed, during which received messages are lost permanently.) as long as "reset rest of store" is still a thing, this bug cannot be fixed.