Set no-cache headers on datagrid initial response.

Review Request #13750 — Created April 18, 2024 and submitted — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

We already were setting the proper Cache-Control headers for the
datagrid listview, which is used for inline reloading of the datagrid
contents. Unfortunately, we didn't have matching headers for the
datagrid pages themselves. This was mostly not noticeable, except for
one highly annoying thing: if you selected a checkbox and then clicked
an action (such as archive), the action would run and everything would
look fine. If the page was then reloaded, Firefox would very helpfully
try to re-select checkbox in the same row number, even though that
didn't correspond to the one that was checked and archived. Setting the
cache headers (in particular, Cache-Control: no-store) turns off this
behavior in Firefox.

While I was doing this I replaced the existing code with Django's
add_never_cache_headers, which does the same thing with less
verbosity.

  • Ran unit tests.
  • Selected a review request and clicked "Archive" in the actions
    sidebar. Saw the datagrid update as expected. Clicked the reload
    button in the browser, and saw that Firefox no longer tried to select
    any checkboxes.

Commits

Files

    Loading...