Dun-sin / Whisper

A fun Application to have a random chat with people safely
https://whisper.favour.dev/
MIT License
379 stars 342 forks source link

fix: Room not found #584

Closed MJinH closed 9 months ago

MJinH commented 9 months ago

Fixes Issue

My PR closes #577

πŸ‘¨β€πŸ’» Changes proposed(What did you do ?)

  1. commented out the lines in anonymous.tsx file. Had an issue where the socket would connect on the server side but immediately disconnect on the client side, which was causing the NEW_EVENT_CHAT_RESTORE event to not work properly.

  2. After debugging, noticed that the createChat function wasn't being called properly in the anonymous.tsx file. suspect this was because it was being called before the provider was initialized, so wrapped the components with ChatProvider in the _app.tsx file and confirmed that it was working correctly.

βœ”οΈ Check List (Check all the applicable boxes)

Note to reviewers

πŸ“· Screenshots

vercel[bot] commented 9 months ago

Someone is attempting to deploy a commit to a Personal Account owned by @Dun-sin on Vercel.

@Dun-sin first needs to authorize it.

Dun-sin commented 9 months ago

Will review this later in the day @MJinH in the mean time, please remove the package files, don't delete them but remove them from your PR. Thanks

MJinH commented 9 months ago

Could you please check this? in the ChatContext.tsx file, when the name is "chatId" in the createChat, it seems to result in 'undefined' in the chatReducer as shown in the image. When using 'id', it looks like it's assigned correctly. Please let me know if i missed something. Also, yes you're right. I forgot to remove the context in the PageWrapper.tsx file.

Screenshot (211)

Screenshot (208)

Dun-sin commented 9 months ago

Could you please check this? in the ChatContext.tsx file, when the name is "chatId" in the createChat, it seems to result in 'undefined' in the chatReducer as shown in the image. When using 'id', it looks like it's assigned correctly. Please let me know if i missed something. Also, yes you're right. I forgot to remove the context in the PageWrapper.tsx file.

Screenshot (211)

Screenshot (208)

i guess the issue comes from here: remove the ID and leave the chat Id, should fix it, can't believe i missed that making it, also i would prefer the provider to be the in the pageWrapper:

chatId,

not thisπŸ‘‡ https://github.com/Dun-sin/Whisper/blob/94b3b503ac05dd3d4cf6e9ad6250da494cead95c/src/reducer/chatReducer.ts#L24

MJinH commented 9 months ago

got it, and if the provider is in PageWrapper, the createChat in anonymous.tsx doesn't seem to be called properly. When debugging, it gets called as createChat: () => {} and exits immediately. can you please check this as well?

I'll fix those and recommit later. Thank you.

Dun-sin commented 9 months ago

Also @MJinH what exactly do you mean in Anonmyous.tsx?

MJinH commented 9 months ago

What I mean is, when ChatProvider is in PageWrapper, createChat is exeucted like this room-1.webm

and this is when the provider is in _app.tsx room-2

Dun-sin commented 9 months ago

What I mean is, when ChatProvider is in PageWrapper, createChat is exeucted like this room-1.webm

and this is when the provider is in _app.tsx room-2

I see your point, yours is a better way thenπŸ’ͺ🏽 but the other things still count

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
whisper βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jan 6, 2024 7:45am