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

Issue: Chat Automatically Closes on Page Reload #7

Open
Devyalamaddi opened this issue Jan 19, 2025 · 0 comments
Open

Issue: Chat Automatically Closes on Page Reload #7

Devyalamaddi opened this issue Jan 19, 2025 · 0 comments

Comments

@Devyalamaddi
Copy link

When a user opens a chat with a specific user and reloads the page, the opened chat is automatically closed. This disrupts the user experience as the app does not retain the selected chat context after a page refresh.

Expected Behavior
The app should persist the selected chat so that, after reloading the page, the user is automatically returned to the chat they were viewing.

Current Behavior
The selectedUser state is reset to null on page reload, causing the opened chat to close. This requires the user to manually select the chat again.

Steps to Reproduce

  1. Open a chat with a user.
  2. Reload the page.
  3. Observe that the opened chat is closed, and the user is returned to the default state.

Proposed Solution
Use localStorage to persist the selectedUser state. By storing the selectedUser object in localStorage as a string, we can retrieve it when the app initializes. This ensures the user's chat selection persists across page reloads.

Benefits
Improved user experience by retaining the chat context after a reload.
Aligns the application behavior with user expectations for a seamless chat experience.

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

1 participant