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

hide chat is not working #62

Open
chaitanya71998 opened this issue Nov 20, 2022 · 6 comments
Open

hide chat is not working #62

chaitanya71998 opened this issue Nov 20, 2022 · 6 comments

Comments

@chaitanya71998
Copy link

chaitanya71998 commented Nov 20, 2022

Greetings,
I was using hide-chat in a botpress project. I created a flow to make composer hide and should be visible only when required.
Sometimes its working fine but and not working sometimes, especially when I am using for mobiles. Not knowing why is this happening. Can I know what is the issue here and how to solve it

here is the link to the flow I created with hide-chat module https://drive.google.com/drive/folders/1a1uCL-gvzlbgWwnpfg8qZmKWVJtr366Y?usp=sharing

also what are these conditions isBotMessage && isLastGroup we are using for, can we remove these conditions, if removed will they cause any issue?

if (isBotMessage && isLastGroup) {
      composer.setHidden(hidden)
    }

Thanks in advance

@chaitanya71998 chaitanya71998 changed the title hide chat is not working in mobiles hide chat is not working Nov 28, 2022
@bassamtantawi-botpress
Copy link
Member

Hi @chaitanya71998 ,

Do you want to hide only the composer or minimize the whole bot?

@chaitanya71998
Copy link
Author

Hi @bassamtantawi-botpress yeah wanted to hide composer

@ptrckbp
Copy link
Contributor

ptrckbp commented Nov 28, 2022

The conditions are used to make sure that if the chat is restored (user opens and closes window), and there are more than one component in the message list, just the one from the last group gets executed (race condition). This is due to the component executes code onMount.

We aren't sure why it's not working for you sometimes. You might want to put a bunch of console.logs and try it out with different screen sizes in your browser. If the problem only happens on mobile, you can create an api endpoint using https://requestbin.com/ and call the endpoint when the state changes in the component. If you manage to write code that reproduces the issue reliably, let us know.

@chaitanya71998
Copy link
Author

chaitanya71998 commented Nov 29, 2022

Hi @ptrckbp can you explain more clearly i didn't understand the use of condition,
will it cause problem if we remove conditions?

@ptrckbp
Copy link
Contributor

ptrckbp commented Nov 29, 2022

The conditions are used to prevent a race condition, so if you remove them, you will occasionally encounter issues. Are they the ones causing issues with mobile?

@chaitanya71998
Copy link
Author

No, before removing condition this issue is coming.

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

3 participants