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

Handle empty search queries in a helpful manner #53

Merged
merged 7 commits into from
May 26, 2023

Conversation

jongranados
Copy link
Collaborator

@jongranados jongranados commented May 25, 2023

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

  • Provide the user with some feedback when their search yields nothing.

Stretch goal

  • Provide the user a with a quick way to add the item they intended to look for.

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
💯 Add tests
🔗 Update dependencies
📜 Docs

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

  • Visit the preview URL for this PR.
  • Join an existing list or create a new one and add a few items to it.
  • Attempt to search for an item that is not in your list.
  • Verify that the application informs you that a matching item was not found.
  • Verify that the application provides you with a way of adding the non-existing item.
  • Attempt to add the non-existing item.
  • Return to your list and ensure that the item now exists in your list.

@github-actions
Copy link

github-actions bot commented May 25, 2023

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

@jongranados jongranados marked this pull request as ready for review May 26, 2023 02:01

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.
Copy link
Collaborator

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!

Copy link
Collaborator

@emilysellers emilysellers left a 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.

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