pablobm left a comment (openstreetmap/openstreetmap-website#6564)
I have been looking a bit more into the heatmap issue. I think it's unrelated
to this PR, a pre-existing lingering issue. Specifically I'm observing the
following sequence of events on test failures:
1. The test ends and calls `teardown`.
2. [`Capybara.reset_session!` is
called](https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb#L16).
3. `Users::HeatmapsController#show` begins.
Hypothesis: the Ajax request for the heatmap fires late, at a point when the
cookie jar has been discarded. Therefore there's no session when the controller
action runs, and `@heatmap` is not set.
I also noticed that [`HeatmapsController#show` checks for `@user` to be
set](https://github.com/openstreetmap/openstreetmap-website/blob/6ca74538293c56da5309fdde0a2b956207126de2/app/controllers/users/heatmaps_controller.rb#L16).
If it's not set, then `@heatmap_data` won't be set and the view will fail
anyway. From here, I think it makes sense to check for `@heatmap_data` in the
view, as the controller does allow for the possibility of not setting it.
Summary: PR good, plz approve :pleading_face: (Happy to be contradicted!)
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6564#issuecomment-3612295106
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/6564/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev