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.
Hello,
Using entityqueue with views (relationship + sort), when I update the queue, for example adding items, the view cache is not regenerated.
You can see the configuration on this repository: https://github.com/Drupal-FR/socle-drupalcampfr
I use entityqueue for sorting news on the homepage.
I currently don't have the time to investigate sorry.
Thanks for any help.
Comment | File | Size | Author |
---|---|---|---|
#7 | entityque-warning.png | 36.73 KB | sdstyles |
#7 | 2686623-7.patch | 682 bytes | sdstyles |
#4 | 2686623.patch | 3.33 KB | amateescu |
Comments
Comment #2
GrimreaperEditing git repository URL.
Comment #3
krlucas CreditAttribution: krlucas at Genuine commentedThere are two potential caches that EntityQueue needs to be aware of, the Views result cache (the "Cache" setting in the View's UI) and the Drupal render cache.
I haven't been able to successfully figure out where the Views relationship or sort plug-ins for entityqueue would provide the proper cache tags.
But I did create a hook in a custom module that adds cache tags to the View's render array so that the render cache is invalidated when an entityqueue is saved. For this to work the View has to be configured with (results) Cache = None.
Comment #4
amateescu CreditAttribution: amateescu as a volunteer commentedThat's because Views cache plugins do not take into account possible cache tags that could be provided by other views handlers (relationship, filter, etc.) :/ I opened a core issue for this #2710679: Views handlers should be able to add cache tags to the views results cache and implemented a workaround for now: invalidate the
<target_entity_type>_list
cache tag when a subqueue is updated.Comment #6
amateescu CreditAttribution: amateescu as a volunteer commentedCommitted and pushed to 8.x-1.x.
Comment #7
sdstyles CreditAttribution: sdstyles at FFW commentedThe method
$target_entity_type->getListCacheTags()
already returns an array of strings, so we don't need to force it to be an array, as result this throws an error inmergeTags()
because tag is an array not a string, see the screenshot with error.Comment #9
amateescu CreditAttribution: amateescu as a volunteer commentedOops, that's right :) Committed the followup patch, thanks!
Comment #10
GrimreaperThanks for the patches. It works well.