Repository navigation
Ask for the command list again when the room or inventory changes - #168
Merged
Merged
Conversation
The list of commands a player can type was fetched once, at login, and went stale as soon as they moved. The client now asks again when its room number changes or the set of things it carries changes, after both have held still for 1.5 seconds, so walking through several rooms asks once at the end. Things arriving in or leaving the room do not ask: in a busy room that would rebuild the list every time someone walked through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes
The command list (Commands panel, first-word Tab completion) was fetched once at login and went stale when you moved. The client now sends
dns-com-awns-rehash-getcommandsagain when:Room.Infochanges, orBoth are debounced together by 1.5 s (
COMMAND_REFRESH_DELAY_MS), so walking through several rooms asks once, at the end.Why the client asks, instead of the MOO pushing
Building the list costs the MOO 0.3 s for a 188-item inventory and 0.6 s for a 428-item one (measured live; the inventory is most of it). A push on every move would spend that per room per web-client user. A server-side diff would need per-session cached state. Asking from the client needs neither.
Not covered
Tested
npm test: 130 files, 1575 tests pass (4 new, with fake timers: one request after several quick room changes; inventory change asks, an identical list does not; room contents do not; nothing after disconnect).npm run typecheckclean.