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

Bug fix - Map not showing full users after clear with large data set #5474

Closed
wants to merge 8 commits into from

Conversation

nabramow
Copy link
Member

@nabramow nabramow commented Jan 15, 2025

We introduced a bug in #5413 . It was due to there being a smaller data set on stage, so hard to notice. To replicate on prod:

  1. Go to map, see initial load with everything
  2. Search a location
  3. Clear filters
  4. No way to get all the full pins back

This PR fixes that. You should repeat those steps above but be able to go back to your initial view.

Web frontend checklist

  • [ x ] Formatted my code with yarn format
  • [ x ] There are no warnings from yarn lint --fix
  • [ x ] There are no console warnings when running the app
  • [ x ] All tests pass
  • [ x ] Clicked around my changes running locally and it works
  • [ x ] Checked Desktop, Mobile and Tablet screen sizes

Copy link

vercel bot commented Jan 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
couchers ✅ Ready (Inspect) Visit Preview Jan 17, 2025 1:51am

@nabramow nabramow changed the title Fix pagination not being reset Bug fix - Map not showing full users after clear with large data set Jan 15, 2025
@jesseallhands
Copy link
Contributor

I just tried testing this on mobile and it's proving hard to test because the number of test users on vercel/next appears to be the same or similar to the max count of users (100) that we display due to pagination (that was how the bug made it through to production in the first place).

I encountered a new issue during testing: the "clear filters" button remains grayed out despite a filter being applied. How to replicate:

Search for Berlin. The search zooms in and takes you to berlin. Then move the map around a bit and click "search here". Despite the location filter still being applied, the "clear filters" button is still grayed out.

I'm on my way to work right now, I can post a video of my screen after work if needed.

@nabramow nabramow marked this pull request as draft January 15, 2025 16:30
@@ -148,8 +148,10 @@ it("should show proper error if startDate is today but startTime is in the past"

const startTimeErrorText = await screen.findByTestId("startTime-helper-text");

expect(startTimeErrorText).toHaveTextContent(
t("communities:past_time_error")
await waitFor(() =>

Choose a reason for hiding this comment

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

Why is this waitFor being added does this have anything to do with the bug fix? Or just a testing issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah this was a comment Aapeli made during the meeting that a test was failing on develop after this PR merged, and he sent me this test as the culprit. There's some tests after the React v18 upgrade randomly failing still as they run slower on deployment then locally so we didn't catch them.

@@ -163,9 +163,9 @@ export default function SearchPage({
completeProfileFilter !== false ||
queryName !== "" ||
locationResult.name !== "" ||
wasSearchPerformed !== false;
(locationResult.location.lng !== 0 && locationResult.location.lat !== 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not that it is really negatively affecting anything by having it but just to shed some light on why I decided to not use locationResult.location.lng/lat previously...

locationResult.name provides more reliable state tracking for searches because:

  1. On initial search from the dashboard:

    • locationResult.name updates correctly (via URL params)
    • locationResult.location coordinates remain at 0
  2. On subsequent searches from within the map:

    • Both locationResult.name and coordinates update as expected

Since locationResult.name consistently indicates whether a specific place was searched for across both initial and subsequent searches, it's a more reliable indicator than the coordinate values. Adding a dependency on locationResult.location seemed redundant/ potentially misleading due to its inconsistent behavior on initial load.

Copy link
Member Author

@nabramow nabramow Jan 16, 2025

Choose a reason for hiding this comment

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

@graceegal with the locationResult.location.lng/lat vs locationResult.name, from my memory you're not always guaranteed to have both. If you scroll around the map then hit "searchHere", for example, I think you only have bbox? Please check me though I might be remembering wrong! I remember from a past ticket that certain types of searches don't give you everything.

@@ -163,9 +163,9 @@ export default function SearchPage({
completeProfileFilter !== false ||
queryName !== "" ||
locationResult.name !== "" ||
wasSearchPerformed !== false;
Copy link
Contributor

Choose a reason for hiding this comment

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

I just tried testing this on mobile and it's proving hard to test because the number of test users on vercel/next appears to be the same or similar to the max count of users (100) that we display due to pagination (that was how the bug made it through to production in the first place).

I encountered a new issue during testing: the "clear filters" button remains grayed out despite a filter being applied. How to replicate:

Search for Berlin. The search zooms in and takes you to berlin. Then move the map around a bit and click "search here". Despite the location filter still being applied, the "clear filters" button is still grayed out.

I'm on my way to work right now, I can post a video of my screen after work if needed.

Just replicated @jesseallhands new issue and checked it out - I think it is happening because this line was removed. If you add a different filter, besides location, and follow the same steps he outlined, the button works as intended and doesn't grey out.

Quick note on the "Search here" button - it resets locationResult to avoid conflicts between:

  • The original location search (e.g., "Berlin")
  • The new position-based search from search here

This makes sense since having both would be contradictory (if you search "Berlin", move to NYC and hit "Search here", you wouldn't want both active).

So without the removed line, the clear filters button's enabled state doesn't account for search here searches, making it appear disabled even though the map position is filtering the results.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe I'm getting confused, isn't filtersApplied what we use to decide wasSearchPerformed? So they are representing the same thing? Gosh I hate this map lol.

@nabramow
Copy link
Member Author

Closing, the scope of this exploded quite a bit. We will leave it for now as I will try and redo the map soon.

@nabramow nabramow closed this Jan 18, 2025
@nabramow nabramow deleted the na/web/bugfix-map-clear branch January 30, 2025 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants