useUserDialogListState seems to cause components to render twice on page load #3725
-
I'm using this hook in a next.js app. Without the UserDialog component and useUserDialogListState hook on my page, the component loads once on page load. When I add these in, the component renders twice. Any idea why it's doing this?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Disclaimer: This is a very experimental bot using OpenAI's GPT-4. The answers may not be correct, a human will review the answer and update it if necessary. Sorry, I don't know how to help with that. I did do a search though, and I managed to find these other Discussions that might be similar or related to your question. Give them a read to see if they answer your question. If they do, head back here and update this discussion and mark it as answered, pointing others to the related discussion:
|
Beta Was this translation helpful? Give feedback.
-
🤖 Hello @twilio-jyoung! 👋 I'm Dosu, a friendly bot here to help you with the Paste project while we wait for one of the human maintainers. I'm here to assist with bug resolution, answer any questions you might have, and even guide you in contributing to the project. Let's see if we can unravel this mystery together! 🕵️♂️ The behavior you're observing might be due to the way React handles state updates and re-renders. When you use the In your To avoid this, you could move the state initialization outside of the component function, or use a The I wasn't able to find a specific reason within the Paste repository why the For more information, you can refer to the UserDialogContainer and UserDialogList components in the Paste repository. Let me know if you need further assistance. Dosu Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Hey @twilio-jyoung - can you please provide a codesandbox reproduction? |
Beta Was this translation helpful? Give feedback.
Marking this discussion as answered due to inactivity. Let us know if you need help sending over a codesandbox repro! Happy to continue discussing.