kyurikotpq / cycleos-rn

Hustle less, flow more. Android app built with React Native.
0 stars 0 forks source link

fix: Filtering of symptoms doesn't reset #6

Open kyurikotpq opened 3 weeks ago

kyurikotpq commented 3 weeks ago

Description

When the filter query is cleared, only the category of symptoms that has items matching the previous query is shown.

Reproducible Example

  1. Type "Dry" (the Skin category and dry skin will appear)
  2. Clear the filter query
  3. Only the items in the Skin category is shown

Expected behavior

All of the symptoms should be shown if the query string = ""

Potential Code to Rewrite

This is a dumb one. There's no else statement in here (tracking.tsx):

useEffect(() => {
    if (searchQuery.length > 2) {
      setFilteredSymptoms(
        SYMPTOMS_CATEGORIZED.filter((category) =>
          category.items.some((symptom) => isSymptom(symptom.label))
        )
      );
    }
  }, [searchQuery]);