codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

[web] Sorting is not saved on the Reports view when returning from a bug's details

Open whisperity opened this issue 3 years ago • 0 comments

Describe the bug

When changing the sorting of the report list and then opening a bug and then returning to the bug list, the sorting information is lost.

CodeChecker version

6.21 stable (official PyPI) release

To Reproduce

  1. Open the following URL that is a filtered view of some bugs: https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?review-status=Unreviewed&review-status=Confirmed%20bug&detection-status=New&detection-status=Reopened&detection-status=Unresolved&run=%2ataint_improvement_fixed&is-unique=off&diff-type=New&checker-msg=%2auntrusted%2a&checker-msg=%2ataint%2a&sort-by=bugPathLength&sort-asc=true&sort-desc=true
  2. By default, this view is sorted with the longest bugs first, aka sort-desc=true.
  3. Click on the column header for "Bug path length" and see that it sorts as ascending (shortest bug path first, which I want to view)
  4. The URL changes to https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?review-status=Unreviewed&review-status=Confirmed%20bug&detection-status=New&detection-status=Reopened&detection-status=Unresolved&run=%2ataint_improvement_fixed&is-unique=off&diff-type=New&checker-msg=%2auntrusted%2a&checker-msg=%2ataint%2a&sort-by=bugPathLength&sort-asc=true&sort-desc=false, and now ends with sort-desc=false at the end
  5. Open a bug, e.g., the first one in the list
  6. Now the bug URL (https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?review-status=Unreviewed&review-status=Confirmed%20bug&detection-status=New&detection-status=Reopened&detection-status=Unresolved&run=%2ataint_improvement_fixed&is-unique=off&diff-type=New&checker-msg=%2auntrusted%2a&checker-msg=%2ataint%2a&sort-by=bugPathLength&sort-asc=true&sort-desc=false&report-id=1356911&report-hash=7cafabdfa1aa3459cfee8da281bbea5a&report-filepath=%2Flocal%2Fpersistent_docker%2FCSA-measurements-driver-70%2Fmeasurements_workspace%2Ftmux%2Fstatus.c) changes again, and in the middle, it contains something like sort-asc=true
  7. Click the "Back to reports" button
  8. We return to https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?review-status=Unreviewed&review-status=Confirmed%20bug&detection-status=New&detection-status=Reopened&detection-status=Unresolved&run=%2ataint_improvement_fixed&is-unique=off&diff-type=New&checker-msg=%2auntrusted%2a&checker-msg=%2ataint%2a&sort-by=bugPathLength&sort-asc=true&sort-desc=true, where we have sort-asc=true&sort-desc=true in the URL and now the longest bug is on the top, and I need to sort again.

Expected behaviour

Sorting preferences (just like the filters) are saved in the view appropriately, i.e., I get back seeing the shortest bug first.

Additional context

Likely the issue is that we append both sort-asc and sort-desc into the URL and either one of them (or the last one in the text?) takes priority.

whisperity avatar Apr 13 '23 16:04 whisperity