Add Cache Context to Views when using entity QueryAccessHandler

Created on 29 January 2025, 2 months ago

Problem/Motivation

Cache contexts that are added in buildConditions() are not added to a View.
For example, when adding the 'user' cache context, every user should get a different version. Currently this is not working because of the missing cache context.

Steps to reproduce

- Create ContentEntity, add "query_access" handler
- Add Cache Context inside the condition
$conditions = new ConditionGroup('AND');
$conditions->addCacheContexts(['user']);
- Create a View that shows these ContentEntities
- Login as User 1. You get results for user 1.
- Login as User 2. You get result for user 1, because the Cache Contexts are not added to the View.

Proposed resolution

- Add Cache Context to the View

Remaining tasks

None.

User interface changes

-

API changes

-

Data model changes

-

πŸ› Bug report
Status

Active

Version

1.5

Component

Views integration

Created by

πŸ‡³πŸ‡±Netherlands Sander Wemagine

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024