Skip to content

Ask for the command list again when the room or inventory changes - #168

Merged
ctoth merged 1 commit into
masterfrom
feat/rehash-refresh
Oct 6, 2026
Merged

ctoth merged 1 commit into
masterfrom
feat/rehash-refresh

Conversation

@ctoth

@ctoth ctoth commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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-getcommands again when:

  • the room number in Room.Info changes, or
  • the set of item ids in the inventory changes.

Both 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

  • Things arriving in or leaving the room do not trigger a refresh. In a busy room that would rebuild the list each time someone walked through. The Refresh button still works.
  • Adding or removing a feature object does not trigger a refresh; the client has no signal for it.

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 typecheck clean.

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.
@ctoth
ctoth merged commit 989a320 into master Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant