Problem/Motivation
I'm currently upgrading OpenCulturas in KultinO to 2.6.0 and am experiencing a weird behavior on the dates map: instead of showing only the first 60 items, each iteration in the background adds another 60 items to the list. Due to the fact that we have thousands of events, the list gets longer and longer, filling up the browser's memory until it is completely unusable.
Steps to reproduce
Proposed resolution
I spent some time in the debugger and was able to track down the issue to this line in Drupal\openculturas_map\Plugin\Form\OpenCulturasMapFilterForm:117:
if ($this->viewExecutable->pager !== NULL) {
$form['#pager'] = $this->viewExecutable->pager;
}
This checks for the existence of a pager, without taking care whether initPager() has already been called. In some circumstances, this can return NULL even if the view does have a pager configured.
Instead we should do this:
if (($pager = $this->viewExecutable->getPager()) !== NULL) {
$form['#pager'] = $pager;
}
I have to admit that the mentioned code block hasn't changed between OC 2.5 and 2.6, so I have no idea why this issue occurs to me starting with 2.6. Might have something to do with the update from Drupal 10.5 to 10.6.
Nevertheless, the above change fixes the issue for me.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork openculturas-3588253
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3588253-oc-map-ignores
changes, plain diff MR !14
Comments
Comment #3
mrshowermanComment #6
tobiasbI change the patch a little bit. ;-)
Commited to 3.0.x and 2.6.x.