If you place the "Entity view" block using the core block system (ex. into the footer), and then go to a node view page, you'll correctly see the entity rendered again where you placed the block. However, when you go to any other page (including other node view pages) it'll continue to show the first node! If you clear the cache (ie. via drush cr) then reload the 2nd node view page, it'll switch to rendering that node on all pages.

FYI, if the first page you visit isn't a node view page, it'll cause a fatal error due to this core bug: #2620126: No way to handle 'optional' contexts without try/catch

I assume this is something with getting the render cache information wrong. This should be handled automatically by ContextAwarePluginBase but apparently isn't!

Comments

dsnopek created an issue. See original summary.

dsnopek’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB

Here's a patch based on the render cache stuff we did in #2561935: Create a block for every field (which'll take the entity as context). It works in my testing!

  • EclipseGc committed ef7369e on 8.x-3.x authored by dsnopek
    Issue #2631120 by dsnopek: "Entity view" block showing first entity...
eclipsegc’s picture

Status: Needs review » Fixed

Yeah, this looks great, thanks!

Eclipse

Status: Fixed » Closed (fixed)

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