alibaba / alibaba/ChatUI

setTyping is not a function

Open
#184 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.4k
Forks
425
PR merge metrics
No merged PRs in 30d

Description

**Version information (版本信息)**
- ChatUI
- ChatUI Version: 3.0.0
- React Version: none
- OS Version: -
- Browser Version: -

**Describe the bug (描述问题)**
setTyping is not a function
TypeError: setTyping is not a function

**Steps To Reproduce (重现步骤)**
```
import React from "react";
import Chat, { Bubble, useMessages } from "@chatui/core";
import "@chatui/core/dist/index.css";

export default function App() {
const { messages, appendMsg,setTyping } = useMessages([]);

function handleSend(type, val) {
if (type === "text" && val.trim()) {
appendMsg({
type: "text",
content: { text: val },
position: "right",
});

setTyping(true);

// 模拟收到消息
setTimeout(() => {
appendMsg({
type: "text",
content: { text: "Bala bala" },
});
}, 1000);
}
}

function renderMessageContent(msg) {
const { type, content } = msg;

// 根据消息类型来渲染
switch (type) {
case "text":
return ;
default:
return null;
}
}

return (

);
}
```
https://codesandbox.io/p/devbox/chatui-demo-forked-qssjtc

**Link to minimal reproduction (最小化重现链接)**

**Expected behavior (期望的结果是什么)**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproduced App example and the useMessages API, then run the linked CodeSandbox to confirm the setTyping failure in ChatUI 3.0.0. Trace where the hook's returned values are defined and compare that behavior with the example's usage. Done means the reproduction no longer raises the TypeError and the intended typing behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.