Ajax calls broken Intermitently in Drupal 10

Created on 6 August 2024, 4 months ago

Problem/Motivation

I am working on Drupal 10 site. On servers, intermittently ajax calls gets break and page redirects on ajax calls.
When i am clearing Drupal cache, it started working again.
Can someone please help me?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.2

Component
Ajax 

Last updated 1 day ago

Created by

🇮🇳India shailja179 India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @shailja179
  • 🇫🇷France nod_ Lille

    Please explain more in detail what breaks, how, in which situations etc.

  • 🇮🇳India shailja179 India

    We are running a Drupal 10 site. But intermittently, ajax on all over site gets break.
    And we are clearing the Drupal cache, it works again. What could be the reason for this behaviour, we are not sure.

  • We would have to see technical information to provide technical help.

  • Status changed to Postponed: needs info 4 months ago
  • 🇬🇧United Kingdom longwave UK

    links with use-ajax class redirecting instead of opening pop up

    This suggests a JavaScript error; are there any JS errors in the console when this happens?

  • 🇨🇷Costa Rica yuvania

    Did you notice if this issue started after an update? You might also want to check the logs and JavaScript console for specific errors, and maybe try disabling the cache temporarily to see if that helps isolate the cause

  • 🇬🇧United Kingdom tce

    I have started experiencing this, it might be the same issue as it's a fairly recent bug for me.

    AJAX on forms stop working and work again after clearing cache. I can replicate the issue by following the below steps...

    1) Clear the Drupal cache
    2) Visit the page the form is on but have the ajax related params in the URL. E.g. https://www.mysite.com/form?ajax_form=1&_wrapper_format=drupal_ajax&_wrapper_format=drupal_ajax
    3) Visit the form page as usual, AJAX is now broken

    It seems that in step 2, caching for the form is happening, but it's caching empty values. It's caching empty values in the cache_data table. The cid is like js:theme_name:en:xxxx

    I'm no expert, but to me the issue is the way the AssetResolver::getJsAssets creates the Cid name. It creates the same Cid name, even if the cache data is an array of empty/false values

  • 🇬🇧United Kingdom tce

    I tried upgrading core after reading this 👉 https://www.drupal.org/project/drupal/issues/3443108 📌 Optimize AssetResolver caching Fixed but I still get the issue with Drupal version 10.3.6

Production build 0.71.5 2024