-
Notifications
You must be signed in to change notification settings - Fork 1
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
Handle empty search queries in a helpful manner #53
Conversation
Visit the preview URL for this PR (updated for commit 893dae1): https://tcl-57-smart-shopping-list--pr53-jg-handle-empty-sear-cyx52ghq.web.app (expires Fri, 02 Jun 2023 01:24:46 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: ad3eb6c34c2ec5986fcc218178df5985eb9c9ffb |
|
||
export function AddItem({ listToken, data }) { | ||
const [itemName, setItemName] = useState(''); | ||
const { state } = useLocation(); // React Router DOM state - persisted between List and Add-Item routing - leveraged to quickly add a non-existing item the user attemped to search for. |
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.
I haven't see useLocation() before - this is cool! Nice work, Jon!
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.
Great work, @jongranados ! The addition of the functionality to add the item being searched for is a really nice touch.
For an example of how to fill this template out, see this Pull Request.
Description
This PR adds features that provide the user with feedback when their search query returns empty. Additionally, it provides them a way to quickly add these non-existing items to their list, right when they discover that it doesn't exist in it. The feedback was implemented by leveraging MUI's TextField error handling. The quick-add feature was implemented by leveraging React-Router-Dom's location-specific state which allowed for the persistence of the user input between components at two different locations.
Related Issue
Closes #46
Acceptance Criteria
Stretch goal
Type of Changes
Updates
Before
The user was not provided any feedback when their search did not match anything in their list.
1.mov
After
The user is provided feedback and a quick way to add the non-existing item to their list.
2.mov
Testing Steps / QA Criteria