Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As mentioned on Skype with fubhy, modified omega_js_alter to remove ajaxPageState if the misc/ajax.js file isn't included in the JS files. Small modification in omega_get_js too as that forcefully adds it partially back.
In terms of my testing, I've played around with pages that do use the AJAX system and they still work fine (and contain the ajaxPageState settings on the page). Anyone with access to more complex sites may want to test this...
Patch in #1...
Comment | File | Size | Author |
---|---|---|---|
#8 | omega-remove_ajaxPageState-1998434-8.patch | 3.21 KB | mjpa |
#1 | omega-remove_ajaxPageState-1998434-1.patch | 2.99 KB | mjpa |
Comments
Comment #1
mjpa CreditAttribution: mjpa commentedThe patch...
Comment #2
attiks CreditAttribution: attiks commented#1 Patch looks good
no space after !
PS: Can you have a look at #1279226: jQuery and Drupal JavaScript libraries and settings are output even when no JS is added to the page it will add major improvements on mobile
Comment #3
msmithcti CreditAttribution: msmithcti commentedI have a site which makes heavy use of the AJAX commands and AJAX in the FAPI. Assigning to me so I remember to review this at some point.
Comment #4
fubhy CreditAttribution: fubhy commentedLet's do this. Just tried it and seems to work. Can you take a final look @splatio and then commit it?
Comment #5
msmithcti CreditAttribution: msmithcti commentedWorks great for me. Committed in b3c106c and pushed.
Thanks!
Comment #7
fubhy CreditAttribution: fubhy commentedNope, this does not work. This currently causes a bug with the Edit module. This is a very rare case but we CAN'T just remove this stuff as it seems to be required when a script adds JavaScript file as a result of the Ajax response.
So, reverting this :).
Reverted in commit 9705213.
If you find a better way of doing this without breaking modules like Edit, please provide a new patch!
Otherwise, please close as "Won't fix"
Comment #8
mjpa CreditAttribution: mjpa commentedSo.. turns out this was actually pretty simple to fix!
The original patch was only checking for misc/ajax.js in the current scope (header / footer) and not the whole page.
Tested the attached patch against the latest Omega 4.x branch, Edit 7.x-1.0+3-dev and a freshly created Omega sub-theme.
Comment #9
mjpa CreditAttribution: mjpa commentedComment #10
justanothermark CreditAttribution: justanothermark commentedI've tested this with Quickedit (the renamed Edit module) and can confirm the patch in #8 does not break it. Even if this isn't committed, I would recommend doing a new release now so that Omega and Quickedit are compatible with non-dev versions (the original patch was reverted after 4.2).
Comment #12
fubhy CreditAttribution: fubhy commentedThanks
Comment #13
joelpittetNot exactly sure how but I believe this is breaking views ajax requests on my site because this didn't happen before the update.
It may only happen with views caching, I'll report back if I have more details.
Comment #14
fubhy CreditAttribution: fubhy commentedComment #15
segovia94 CreditAttribution: segovia94 commentedThis causes all ajax to fail if using the Dialog API module. The Dialog API is looking for these settings that have been removed and everything falls apart.
I'm not sure what the original reasoning for removing these settings was other than just keeping things clean. Perhaps this is a little too heavy handed? I would recommend removing this patch if it doesn't really provide any benefits in regard to performance.
Comment #16
steinmb CreditAttribution: steinmb as a volunteer commentedWe never rolled this back. @fubhy do you have time to comment?
Comment #17
kobb CreditAttribution: kobb commentedJust verifying that reverting the patch in #8 fixes the incompatibility with the Dialog API.
Comment #18
steinmb CreditAttribution: steinmb as a volunteer commentedComment #19
Pierrere CreditAttribution: Pierrere as a volunteer commentedDialog API isn't the only affected module. File Field and Drag'n Drop upload also displayed errors:
"cannot read property 'theme' of undefined" (Chrome)
- or -
"TypeError: Drupal.settings.ajaxPageState is undefined" (Firefox)
when trying to execute an ajax request. Commenting out (reverting) the patched lines in omega/template.php fixed the errors and made the functions usable.
Both errors are from the same page and the same field.
Comment #20
smithmilner CreditAttribution: smithmilner as a volunteer commentedThese settings are used by the scheduler module as well.
scheduler_vertical_tabs.js?:19 Uncaught TypeError: Cannot read property 'theme' of undefined
Comment #21
steinmb CreditAttribution: steinmb as a volunteer commentedComment #22
oana.hulpoi CreditAttribution: oana.hulpoi as a volunteer commentedI can confirm that the patch #8 is breaking views ajax requests, in views exposed filters.
The errors displayed are:
Reverting the patch in #8 fixes the incompatibility.
Comment #23
lauramunro CreditAttribution: lauramunro commentedTook me a very long time to figure out this was the cause of all my problems! Views exposed filters as well as file/image upload fields were just not working.... getting the above errors like everyone else:
Reverting the changes in patch #8 solved my problems