Docs: rewrite the public home and getting-started flow#122
Conversation
|
@codex review Context:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c39c081343
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const [messages, sendTalk] = useSocket<ChatSchema, "talk">("talk"); | ||
|
|
||
| return ( | ||
| <button type="button" onClick={() => sendTalk("hello")}> |
There was a problem hiding this comment.
Disable sending until the WebSocket is open
When this getting-started snippet is copied against a real endpoint, ChatMessages renders as soon as the SocketStore is constructed, so the button can be clicked while the WebSocket is still CONNECTING or after the placeholder endpoint fails. useSocket forwards the click directly to store.send, and the core socket-store send contract throws ERR_SOCKET_NOT_OPEN unless readyState === 1, so the first click can crash the example; gate the button/rendering on an open/onConnect state or otherwise handle the not-open case.
Useful? React with 👍 / 👎.
Summary
Type
Priority
Verification
Release Intent
Notes
Related issue: Closes #117
Verification:
npm run docs:buildnpm run lint