Issue Bug Closed

#103815Custom added categories column in file references palette triggers duplicates by moving records

Julian Mair 05/10/24, 11:03 updated 12/02/25, 14:33

Description

I added a category column to the file references’ image palette. When i move the records up or down, the category tree of the moved element will be duplicated by each move. (see screenshots below)

System:

  • TYPO3 12.4.14
  • PHP 8.3.2
  • MariaDB: 10.11

Steps to reproduce:

  • Add a `categories` column to the sys_file_reference TCA (Configuration/TCA/Overrides/sys_file_reference.php)
    e.g.:
$tca = [   
    'categories' => [
        'exclude' => true,
        'config' => [
            'type' => 'category',
            'size' => 10,
        ],
    ],
];

ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $tca);
ExtensionManagementUtility::addToAllTCAtypes('sys_file_reference', 'categories');
  • Add this field to the `imageoverlayPalette` palette
    e.g.
$palette = [
    'imageoverlayPalette' => [
        'showitem' => 'alternative,description,--linebreak--, link,title,--linebreak--,crop,categories',
    ],
];

$GLOBALS['TCA']['sys_file_reference'] = array_replace_recursive(
    $GLOBALS['TCA']['sys_file_reference'],
    $palette
);
  • Navigate to a media field within a page record, upload at least two images, and rearrange them by dragging up or down. Note that each move will duplicate the categories tree, but you can restore the user interface to its normal state by reloading or saving the page.

Reviews 3

Files 2

History 59

  1. Garvin Hicking commented and changed category <span data-processor="relativetime" data-value="2024-07-31T09:08:24+00:00" > 07/31/24, 09:08 </span>

    Probably something with the web component re-initialisation for IRRE “hot reloading”

  2. Andreas Kienast commented and changed status New Accepted <span data-processor="relativetime" data-value="2025-04-10T12:27:46+00:00" > 04/10/25, 12:27 </span>

    The issue here is that the web component’s connectedCallback() is called again once the position in the DOM changes. I’ve to check whether this can be circumvented somehow without dirty hacks.

    I tried to reset the state with a disconnectedCallback(), which solves the duplicated rendering, but will result in loss of tree state modifications, of course.

  3. Gerrit Code Review pushed patch set 2 for main to change 89039 status Accepted Under Review <span data-processor="relativetime" data-value="2025-04-11T07:47:04+00:00" > 04/11/25, 07:47 </span>

  4. Anonymous commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-04-23T13:10:08+00:00" > 04/23/25, 13:10 </span>

    Applied in changeset commit:0486a119edca9a7e9284d0265cf1aa04b067b4a2.