The title sounds complicated...just as the problem. The scenario: An entity that submits its own id as argument to the attached EVA-View. The entity itself is shown in a view as the row-content. In my case the view showing the fullcontent of the entity has 4 rows. Each time the id of the first row is sended to the EVA-View. Strangely that does not happen in the Preview of the view, but as soon as I visit the actual page the EVA of each row gets the same argument. So I assume that there has to be a problem with cashing. But turning off any views-cache does not solve the problem. The only solution I could find was downgrading back to eva 8.x-1.0-rc1 solves the problem. Does anyone have an idea what could have gone wrong?

CommentFileSizeAuthor
#6 issue-2873385.patch4.68 KBahebrank

Comments

semanthis created an issue. See original summary.

semanthis’s picture

Issue summary: View changes
ahebrank’s picture

Priority: Major » Normal

I'm not sure I understand the scenario -- is this right?

  • There is a View "A" listing entities of type "X"
  • Within each X entity there is an Eva listing "B" (attached to X) displaying entities of type "Y" that are supposed to be contextually filtered by the current X entity
  • The Eva listings B are not behaving as expected because there are all contextually filtering by the first row in A rather than the current A row

If that's right, I'm deprioritizing the issue a bit since it seems like an edge case and I'm (personally) skeptical about this usage. I think the view-within-a-view problem might be better solved by something like https://www.drupal.org/project/views_field_view, where the contextual relationship is more explicitly defined by the current view row. Alternatively, you could probably accomplish this with a single View, aggregating your Y output by the X entities. But... if it worked in an earlier version and isn't now it's still something to investigate.

Can you confirm or correct my rephrasing of the issue?

semanthis’s picture

Hi, thanks for Your help. Yoa are rephrasing the issue in a correct way. That is actually the issue. I do not fully agree that this is a edge case. Shure https://www.drupal.org/project/views_field_view would get me around this issue but for reasons of consistency I perfere using this module. In any cases I ever had this module works fine. In Drupal 7 and earlier versions of this module this worked perfectly.

ahebrank’s picture

I'm unable to replicate using 1.x-dev so I suspect this is either a caching issue or I've made some incorrect assumption.

Using a standard profile setup, I:

  1. Installed Eva and Devel Generate
  2. Created an entity reference field "field_page" on the default Article node bundle targeting Basic Page nodes
  3. Generated 50 random nodes using Devel
  4. Created a page display View to list Basic Page with display mode Full/Default
  5. Created an Eva View to list Articles, attached to Basic Page nodes. This View contains a relationship relating content referenced by field_page, and a contextual filter on ID using that relationship

Browsing to the page View I'm seeing the correct Articles listed with each Page.

If interested, you should be able to replicate this setup using the test-container branch (https://github.com/ahebrank/eva/tree/test-container), which contains a docker network and the field and view configuration above exported. See readme in the ./testing directory. After setting up, importing config, and generating content, browse to http://localhost:9000/2873385 for the page View of Pages with their attached Articles. Note that caching is entirely disabled in this stack.

ahebrank’s picture

StatusFileSize
new4.68 KB

I was able to replicate this issue as a test case. As I understand the underlying problem, with typical cache settings the Eva is cached and the contextual argument (parent entity NID in this case) is not represented as a cache key, so the cache system returns the first Eva for every other Eva on the page (because the only difference between the Evas on the page, in terms of their inputs, is the contextual argument).

This may actually be a Views issue, but I moved some things around and attempted to add a cache key for the display arguments. That seems to work (and tests pass), but would like some feedback about whether this fixes the original issue and (more importantly) whether it breaks other things.

Feature branch is here: https://github.com/ahebrank/eva/pull/16/files ; patch attached.

ahebrank’s picture

Status: Active » Needs review
semanthis’s picture

Hi ahebrank, I'm very sorry that I have not answered earlier, at the moment I have a lot of pressure to finish a D7 project...so the D8-Project is on standby. Thank You for all Your work. I'll test the patch on some of the next days and will let You know if everything is fine.

coecks’s picture

I can confirm that the patch in #6 is working on 1.x-dev.

skybow’s picture

Hi ahebrank, thanks for this patch: I ran into this issue yesterday and was very delighted to see, that someone, you, already created a patch for this. I updated EVA to version 1.2rc2 and installed the patch in #6 and now the problem is gone (for me).

ahebrank’s picture

Status: Needs review » Fixed

Haven't heard any issues associated with the patch and I'm using it now, so merged to dev.

Status: Fixed » Closed (fixed)

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