Does not display a block if it is created using Views.

Created on 8 June 2022, over 2 years ago
Updated 22 March 2023, over 1 year ago

Ajax Block does not display a block if it is created using Views.

🐛 Bug report
Status

Closed: cannot reproduce

Version

2.0

Component

Code

Created by

🇷🇺Russia kolotunbobo

Live updates comments and jobs are added and updated live.
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.

  • 🇫🇷France paulbeaney

    I can confirm that contextual filters seems to be the problem. I have a partially-working way round it for the my use-case - displaying an add-to-cart block for a Commerce Product related to the content being viewed.

    Two steps are required:

    1. In the block Ajax configuration, set it to use GET rather than POST.
    2. In the contextual filter configuration of the view, for the section When the filter value is not available, select Query parameter as the type, and enter nid for Query parameter.

    With these 2 changes, the block shows - albeit with the spinning ajax icon still visible below the block - but only on the first page load after drush cr. Subsequent page loads (which are of course cached by Drupal) result in only the block title and product price showing - the add-to-cart button does not appear, and again the spinning ajax icon remains visible.

    This button problem might be specific to Commerce as I can see a <drupal-render-placeholder callback="commerce_product.lazy_builders:addToCartForm"> tag in the returned JSON.

Production build 0.71.5 2024