Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs in useChatbot #183

Open
zhenxxxx opened this issue Jan 25, 2024 · 0 comments
Open

Bugs in useChatbot #183

zhenxxxx opened this issue Jan 25, 2024 · 0 comments

Comments

@zhenxxxx
Copy link

Hi Team,

I think there is a bug in useChatbot.

useEffect(() => {
    stateRef.current = state;
  }, [state]);

messagePars = new messageParser(actionProv, stateRef.current);

Assuming that the state is updated after rendering the messagePars, the messagePars will be rendered again, but also the old value of stateRef.current will be used, and the value of stateRef.current will be updated again after the execution of useEffect.So the messagePars always use the previous state value, is it by design?

Thanks.

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

No branches or pull requests

1 participant