-
Notifications
You must be signed in to change notification settings - Fork 117
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
base: main
Are you sure you want to change the base?
feat: inbox/persist search text on reload #790
Conversation
@@ -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") || ""); |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
There was a problem hiding this 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
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:
Checklist: