enBloc-org / kindly

Open source repository for the development of Kindly
GNU General Public License v3.0
18 stars 21 forks source link

400 (bad request) when setting messages on current conversation (debugged) #338

Closed AnyaVeselova closed 2 months ago

AnyaVeselova commented 2 months ago

Description of the Bug

Screenshot from 2024-09-20 01-26-41 Screenshot from 2024-09-20 01-26-13 Screenshot from 2024-09-20 01-26-23

Errors were occurring on /conversations page loading. I spent a long time trying to figure out if the issue comes from currentUserId not updating in Context when a new user logs in, but it all came down to adding a guard clause in the setMessagesForCurrentConversation function in the CurrentConversation component.

What should happen instead

We should ensure that currentConversation is defined. This way, when selectMessagesByConversationId is called, it won't attempt to fetch messages with undefined as conversation_id.

Steps to reproduce this bug

  1. The user needs to be logged in
  2. Navigate to messages
  3. Open dev tools

What could we do to solve this bug?

Screenshot from 2024-09-20 01-50-39

Assignment

I'd like to work on this Issue myself

github-actions[bot] commented 2 months ago

🤖 meep morp!

Thank you for your contribution AnyaVeselova!! This Issue has been assigned to you as requested ✨

🔎 Please keep in mind that in order to give everyone a chance to contribute Issues may be unassigned if they go stale. You will be warned if the Issue is marked as stale at any point.

🔎 Please review our documentation for guidance on:

💡 The core team is available for any help and will try to respond to any comments in this Issue or questions on discord as quickly as possible.

Happy coding ! 🦆