Convert Views to use GET for AJAX

Created on 15 August 2022, almost 2 years ago
Updated 17 March 2023, over 1 year ago

Problem/Motivation

After πŸ“Œ Allow AJAX to use GET requests Fixed the AJAX API will allow either POST or GET for AJAX requests.

Views AJAX uses the JavaScript AJAX API directly (as opposed to #ajax), and is relatively simple to convert to GET.

Discussed with @lendude and we came up with the following:

  1. It's preferable if all AJAX-enabled views use GET for performance, since they'll all be able to make use of render caching.
  2. Putting this in Views UI config is undesirable, it's not really a concept we want to expose to site-builders, and there is no benefit to using POST for AJAX unless to workaround a bug.
  3. There is a non-zero chance that this will break either a contributed module, or some custom code, or a view on the site somewhere. It is unlikely anyone is explicitly relying on POST, since non-AJAX-enabled views always use GET anyway, but there could be a view with an extremely long URL and the extra bits with AJAX info could put it over the edge or similar.
  4. Therefore, we should add a flag in $settings (like $settings['views_ajax_use_post']), account for this in the Views AJAX handling, and document it in the change record.
  5. Then (either in this issue or a follow-up) we can deprecate the setting and remove the POST support altogether in Drupal 11

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Closed: duplicate

Version

10.1 ✨

Component
ViewsΒ  β†’

Last updated 30 minutes ago

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024