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

Only trigger one refresh going Back to list view. #3476

Merged
merged 1 commit into from Jun 15, 2021
Merged

Conversation

dracos
Copy link
Member

@dracos dracos commented Jun 11, 2021

If going back from a report page to a list page, a marker refresh would
be triggered twice, once by the popstate, once by display_around. As
only one of those had use_page set, it would at best make two identical
requests, at worst return to page 1 of results whatever page it should
have been showing.

If we're already on a list page, trigger the refresh in popstate as
currently; if not, skip that trigger and rely on the refresh that will
be called in display_around.

An alternative solution would have been to change the refresh in
dispaly_around to use the same debounce as the popstate trigger, which
would fix the issue in that it would only be called once, but introduce
a delay waiting for the end of the debounce time.

Also set use_page when going back to initial state in case that wasn't
the first page of results.

@dracos dracos requested a review from chrismytton June 11, 2021 08:28
@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #3476 (b25823c) into master (b230e50) will decrease coverage by 21.17%.
The diff coverage is n/a.

❗ Current head b25823c differs from pull request most recent head 07ab4f1. Consider uploading reports for the commit 07ab4f1 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #3476       +/-   ##
===========================================
- Coverage   82.46%   61.29%   -21.18%     
===========================================
  Files         326      268       -58     
  Lines       21916    17562     -4354     
  Branches     3304     3300        -4     
===========================================
- Hits        18074    10765     -7309     
- Misses       2787     5632     +2845     
- Partials     1055     1165      +110     
Impacted Files Coverage Δ
perllib/FixMyStreet/App/Form/Wizard.pm 6.66% <0.00%> (-93.34%) ⬇️
perllib/FixMyStreet/DB/Result/AdminLog.pm 8.16% <0.00%> (-85.72%) ⬇️
perllib/FixMyStreet/App/Controller/Auth/Profile.pm 15.96% <0.00%> (-82.36%) ⬇️
perllib/FixMyStreet/App/Controller/Noise.pm 8.59% <0.00%> (-82.04%) ⬇️
perllib/FixMyStreet/App/Controller/Admin/Roles.pm 16.36% <0.00%> (-81.82%) ⬇️
.../FixMyStreet/App/Controller/Admin/ManifestTheme.pm 18.18% <0.00%> (-81.82%) ⬇️
...erllib/FixMyStreet/App/Controller/Questionnaire.pm 11.45% <0.00%> (-80.16%) ⬇️
...ib/FixMyStreet/DB/Result/ModerationOriginalData.pm 10.00% <0.00%> (-78.75%) ⬇️
perllib/FixMyStreet/App/Controller/Admin/States.pm 13.72% <0.00%> (-78.44%) ⬇️
perllib/FixMyStreet/App/Controller/Auth/Phone.pm 14.58% <0.00%> (-77.09%) ⬇️
... and 168 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b230e50...07ab4f1. Read the comment docs.

Copy link
Member

@chrismytton chrismytton left a comment

Choose a reason for hiding this comment

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

🔄

If going back from a report page to a list page, a marker refresh would
be triggered twice, once by the popstate, once by display_around. As
only one of those had use_page set, it would at best make two identical
requests, at worst return to page 1 of results whatever page it should
have been showing.

If we're already on a list page, trigger the refresh in popstate as
currently; if not, skip that trigger and rely on the refresh that will
be called in display_around.

An alternative solution would have been to change the refresh in
dispaly_around to use the same debounce as the popstate trigger, which
would fix the issue in that it would only be called once, but introduce
a delay waiting for the end of the debounce time.

Also set use_page when going back to initial state in case that wasn't
the first page of results.
@dracos dracos merged commit 3893e2b into master Jun 15, 2021
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.

None yet

2 participants