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

3m Solution #6

Open
wants to merge 1 commit into
base: 3m
Choose a base branch
from
Open

3m Solution #6

wants to merge 1 commit into from

Conversation

SuperSimpleDev
Copy link
Owner

No description provided.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, might be missing something, but haven't noticed a solution for the challenge task "If it is loading, don't allow sending a new message". If it is there, my bad :D But if there is none actually, I figured out this one:

Added a 'disabled' attribute to the input element and set it to the isLoading state:

<input disabled={isLoading} placeholder="Send a message" size="30" onChange={saveInputText} value={inputText} onKeyDown={handleKeyDownEvent} />

Changed the 'setIsLoading' state back to false after the Async Chatbot response is generated:

const response = await Chatbot.getResponseAsync(inputText); setChatMessages([ ...newChatMessages, { message: response, sender: 'bot', id: crypto.randomUUID() } ]); setIsLoading(false)

Thanks a lot for your work and sorry in advance if I just didn't notice the solution :D

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think he gave the task for us to figure out to get loading symbol. Afaik we can use CSS for animation and use async fn to load after some time as @SuperSimpleDev has shown in the soln.

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.

3 participants