wanderlust icon indicating copy to clipboard operation
wanderlust copied to clipboard

[BUG] Login of the user doesn't stay if I refresh the page ( Non - consistent )

Open krishnaacharyaa opened this issue 1 year ago • 19 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When I login and then refresh the page, it immediately shows me that I am logged out and asks me to login in again, where as according to the logic it should have waited for 4mins and only after 4mins it should have showed me to login again

Expected Behavior

Until it has hit four minutes I shouldn't be logged out after refresh

Reproduction steps

1. Go to https://wanderlust-beta.vercel.app/
2. Register/Login 
3. See the create-post and logout button
4. Refresh the page.
5. You'll again see the login button

Screenshots

Login and after Refresh

image

Logs

No response

Browsers

No response

OS

No response

krishnaacharyaa avatar May 05 '24 07:05 krishnaacharyaa

cc: @0xmohitsen

krishnaacharyaa avatar May 05 '24 07:05 krishnaacharyaa

@Janith-Chamikara can you kindly look into this...

krishnaacharyaa avatar May 07 '24 06:05 krishnaacharyaa

the cookie is not set in the cookie section when we logged in the website and i am currently working on it sir. @krishnaacharyaa

Ameerjafar avatar May 07 '24 14:05 Ameerjafar

Sure Sir @Ameerjafar

krishnaacharyaa avatar May 07 '24 14:05 krishnaacharyaa

hello sir I need your help. can you check whether token set in the cookie section or not please let me know. @krishnaacharyaa

Ameerjafar avatar May 07 '24 15:05 Ameerjafar

Hi @Ameerjafar please try figuring out, and ask in the team's discord for help, if it doesn't work at all, worst case. We can sync up.

p.s: You can find it in the console of the web browser in the application section there you'll have cookies section... Kindly check there

krishnaacharyaa avatar May 07 '24 16:05 krishnaacharyaa

@krishnaacharyaa I found the exact error sir. whenever we are refreshing the page the home page(header-layout) component will re-render if it is re-render the usestate is set to null because it is not persistent when the page is refresh even it is static.

Ameerjafar avatar May 09 '24 13:05 Ameerjafar

@Ameerjafar Thats a great insight, precisely it is because we are storing the token in the state, instead we should store it in the cookies, and revalidate cookies everytime, if in state, it loses persistence

krishnaacharyaa avatar May 09 '24 14:05 krishnaacharyaa

can i make pr for this i solved this issue sir @krishnaacharyaa

Ameerjafar avatar May 09 '24 14:05 Ameerjafar

Yes please @Ameerjafar , please make sure you followed all the contributing guidelines https://github.com/krishnaacharyaa/wanderlust/blob/9b11b769bb23150b746296cf9008056633d21921/.github/CONTRIBUTING.md#guidelines-for-contributions

krishnaacharyaa avatar May 09 '24 14:05 krishnaacharyaa

Hi there! I'm excited to contribute to this project and would love to work on this issue. Could you please assign it to me? Thanks!

thefarhanahmad avatar May 09 '24 18:05 thefarhanahmad

@thefarhanahmad i have completed this issue just I need to make the pr according to the guidelines has given.

Ameerjafar avatar May 10 '24 14:05 Ameerjafar

@thefarhanahmad i have completed this issue just I need to make the pr according to the guidelines has given.

Yes, follow the guidelines.

0xmohitsen avatar May 10 '24 14:05 0xmohitsen

I have made the pr can you check that sir @krishnaacharyaa

Ameerjafar avatar May 10 '24 14:05 Ameerjafar

Ok, I will check.

On Fri, May 10, 2024 at 7:59 PM Ameer jafar @.***> wrote:

I have made the pr can you check that sir @krishnaacharyaa https://github.com/krishnaacharyaa

— Reply to this email directly, view it on GitHub https://github.com/krishnaacharyaa/wanderlust/issues/172#issuecomment-2104711512, or unsubscribe https://github.com/notifications/unsubscribe-auth/A25A7WKBQRFZ6RHD6VS63JLZBTKS3AVCNFSM6AAAAABHHPWSLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUG4YTCNJRGI . You are receiving this because you were mentioned.Message ID: @.***>

thefarhanahmad avatar May 10 '24 17:05 thefarhanahmad

@krishnaacharyaa can i make pr now according to the guildlines you have provided sir.

Ameerjafar avatar May 11 '24 02:05 Ameerjafar

Sure @Ameerjafar , But I see we are still not very sure on what is the root cause , and how to gracefully handle it from ground up, let's come to a root cause and approach and then raise PR based on the guidelines. That would be much better in my opinion and both of our time would be saved :)

krishnaacharyaa avatar May 11 '24 02:05 krishnaacharyaa

@krishnaacharyaa i have raised the pr for this error sir.

Ameerjafar avatar May 11 '24 12:05 Ameerjafar

@Ameerjafar reviewed it :)

krishnaacharyaa avatar May 11 '24 16:05 krishnaacharyaa