Skip to content

Problem: Sidebar tree can sometimes repeat the same sibling records, causing infinite scrolling

Current Behavior

Steps to reproduce the behavior This behaviour isn't consistent, but can appear when expanding hierarchy branches containing more than 8 records. The sidebar tree shows initial 8 records with '{X} more...' link below. Clicking this link, or scrolling the tree downwards triggers a call to {atom url}/{slug}/informationobject/treeView?show=nextSiblings&resourceId={id}. This can return 7 records - the first 4 siblings, then a repeat of the first 3. This behaviour then repeats on subsequent requests to get 'nextSiblings'. This behaviour is only relevant in the sidebar tree. An affected collection displays records correctly in full-width tree, or when displayed as a 'list'.

Example returned set from a broken nextSiblings request:

  • Item K/PP149/2/2/10 - Papers, 1959-1966, relating to Saunders' MD thesis, 'The control of pain in terminal cancer'
  • Item K/PP149/2/2/11 - Transcripts, 1960-1963, of recorded conversations between Saunders and patients at St Joseph's Hospice, London
  • Item K/PP149/2/2/12 - Transcripts of interviews, 1960-1963, with patients with surnames A-C, St Joseph's Hospice, London
  • Item K/PP149/2/2/13 - Transcripts of interviews, 1960-1963, with patients with surnames D-F, St Joseph's Hospice, London
  • Item K/PP149/2/2/10 - Papers, 1959-1966, relating to Saunders' MD thesis, 'The control of pain in terminal cancer'
  • Item K/PP149/2/2/11 - Transcripts, 1960-1963, of recorded conversations between Saunders and patients at St Joseph's Hospice, London
  • Item K/PP149/2/2/12 - Transcripts of interviews, 1960-1963, with patients with surnames A-C, St Joseph's Hospice, London

Expected Behavior

The request to {atom url}/{slug}/informationobject/treeView?show=nextSiblings&resourceId={id} should return the next 'N' sibling records without repeating.

Possible Solution

It looks like the helper method @ https://github.com/artefactual/atom/blob/f7f5a638e5cd7b040de4f3e0da8fa47ccb117553/lib/model/QubitInformationObject.php#L2309 doesn't refer to any offset or 'start' parameters. The caller @ https://github.com/artefactual/atom/blob/f7f5a638e5cd7b040de4f3e0da8fa47ccb117553/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php#L20 seems to just pass the current resource into getTreeViewChildren(), which runs a fresh query that finds the very first child of that resource, then gets the 'next' siblings ... so each fetch starts from the same first child. No offset or 'current child' is passed in (?) - so pagination still anchors to the first record, and the 'next N' list repeats those earliest rows.

Context and Notes

No response

Version used

AtoM 2.9.1 and 2.9.2 (not tested in 2.10+)

Operating System and version

Ubuntu 22.04

Default installation culture

en

PHP version

No response

Contact details

No response