Hi all
I probably made a wrong search, but the only issue I could find is this http://drupal.org/node/1316610

I updated to 6.x-2.x, with latest stable release of ds, updated the settings.php file.

I am still having issues when one single node is displayed on more than 1 view with DS on the same page (i.e., "teaser" buildmode for content area and "recent posts" buildmode for footer area)

During the second time , the buildmode is not updated and a node displayed in the content area with "teaser" buildmode is still displayed with the same buildmode in the footer area

Any fix?

Comments

xtfer’s picture

Assigned: Unassigned » xtfer

No, no fix yet. I had identified this issue on a production site that I'm working on, but hadn't got around to debugging it yet, as I wasn't sure if it was a localised bug or not. Clearly it isn't, so I'll add it to the queue. Expect a fix at some point...

thoomyorke’s picture

Thanks Xtfer,

just did quick debug.
The bug happens during caching version of DS fields and regions in function nd_build_fields_and_regions(&$node)

line 271 : if (isset($displays[$node->nid])) {

xtfer’s picture

Correct! and also in Display Suite itself somewhere else. I should have patch for this today which fixes it and preserves caching.

nicholas.alipaz’s picture

Just thought I would post my effort in debugging:

$node = node_load(array('nid' => 11384), NULL, TRUE);
$node->build_mode = 'teaser';

$teaser = ($node->build_mode != 'full') ? TRUE : FALSE;
$show_links = ds_show_field('nd', $node->type, $node->build_mode, 'links');

$node = node_view($node, $teaser, FALSE, $show_links);
dpm($node);

$node = node_load(array('nid' => 11384), NULL, TRUE);
$node->build_mode = 'featured_article';

$teaser = ($node->build_mode != 'full') ? TRUE : FALSE;
$show_links = ds_show_field('nd', $node->type, $node->build_mode, 'links');

$node = node_view($node, $teaser, FALSE, $show_links);
dpm($node);

The output rendered the exact same teaser node each time. Not really sure what is going on here.

xtfer’s picture

Display Suite & Node Displays are caching the Display by node ID, not by build mode. Hence, you get the same result every time. Patch coming...

nicholas.alipaz’s picture

I see, yes the following bypasses the issue although I am sure it has some caching ramifications:

/**
 * Statically cached version of ds_build_fields and regions
 */
function nd_build_fields_and_regions(&$node) {
//  static $displays = array();
//
//  if (isset($displays[$node->nid])) {
//    $node = $displays[$node->nid];
//  }
//  else {
    ds_build_fields_and_regions($node, 'nd');
    $displays[$node->nid] = $node;
//  }
}

I will wait for the fix. Thanks for looking at the issue.

xtfer’s picture

The only issue is you lose static caching, which is really only a problem if you reload the node with the same display in two places.

xtfer’s picture

Status: Active » Fixed

I've committed a fix to dev. If it passes tests tomorrow I'll do a release.

nicholas.alipaz’s picture

Thanks, it seems to work for me. Good work and nice and simple solution you implemented.

xtfer’s picture

No problem. Thank you.

Status: Fixed » Closed (fixed)

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

ArielCamino’s picture

Version: 6.x-2.x-dev » 6.x-2.9
Status: Closed (fixed) » Needs work

I updated drupal core to 6.26 and the problem came again :(

xtfer’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
Status: Needs work » Closed (fixed)

@ArielCamino

This issue is fixed and committed, so it is unlikely to be caused by the same issue. Please open a new ticket, with a full description of how to replicate the issue. Thanks.