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

feat: inbox/persist search text on reload #790

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Emnaghz
Copy link
Collaborator

@Emnaghz Emnaghz commented Feb 19, 2025

Motivation

In the inbox page, when a user searches for a text and refreshes the page, the search term was previously not retained. This functionality has now been corrected so that the search term persists even after refreshing the page.

Fixes # #782

Type of change:

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my own code
  • Existing unit tests pass locally with my changes

@@ -31,8 +31,24 @@ export const Inbox = () => {
});
const [channels, setChannels] = useState<string[]>([]);
const [assignment, setAssignment] = useState<AssignedTo>(AssignedTo.ALL);
const [searchText, setSearchText] = useState(localStorage.getItem("searchText") || "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 ! Just a quick suggestion: it would be great to extract the localStorage key for 'searchText' into a constant variable instead of using it as a string directly. This can help prevent any typos in the future and improve maintainability.

Copy link
Collaborator

@yassinedorbozgithub yassinedorbozgithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Emnaghz, can you please use a query param from the router in goal to avoid using localStorage

Copy link
Collaborator

@yassinedorbozgithub yassinedorbozgithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Emnaghz, could we please ensure that the logic supports returning to the initial state when a user enters search text and then presses the browser's back button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🤔 [ISSUE] - URL persist search query text from the inbox page
4 participants