Problem/Motivation

The cookies_addons_views module creates a compatibility issue with the viewsreference module that results in JavaScript errors.

Error encountered:
Uncaught TypeError: Cannot read properties of undefined (reading 'replace') at new Drupal.views.ajaxView (ajax_view.js:104-107)

Steps to reproduce

1. Install cookies_addons_views module
2. Install viewsreference module
3. Create a view with viewsreference fields that is restricted by cookies_addons
4. Visit the page with cookie restrictions active
5. Observe JavaScript error in browser console

Proposed resolution

In cookies_addons_views_views_pre_render(), after removing the views AJAX settings, also remove the #viewsreference marker to prevent viewsreference from adding problematic settings.

Remaining tasks

- Apply the proposed fix to cookies_addons_views module
- Test with various viewsreference configurations

User interface changes

None - this is a bug fix that maintains existing functionality.

API changes

None - the changes are internal to the module's behavior.

Data model changes

None - this only affects JavaScript behavior and AJAX handling.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

scontzen created an issue. See original summary.

scontzen’s picture

Priority: Normal » Major

scontzen’s picture

Status: Active » Needs review
StatusFileSize
new728 bytes

Created a PR and attached a patch with the changes for easy testing.

igor mashevskyi’s picture

Status: Needs review » Needs work

guido_s made their first commit to this issue’s fork.

guido_s’s picture

Version: 1.3.0 » 1.0.x-dev
Status: Needs work » Reviewed & tested by the community

I also just tested it with the viewsreference module and also with the views_field_formatter module and enabled ajax in the view.
Without the new code I can reproduce the ajax error in the console and I can confirm the code fixes it and the view was working fine after clicking the consent button.
I also added the if clause that Ihor also noticed it was missing.
So I think we can merge this now.

  • guido_s committed af20600d on 1.0.x authored by scontzen
    [#3545098] feat: Compatibility issue with the viewsreference module
    
    By...
guido_s’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.