#103815Custom added categories column in file references palette triggers duplicates by moving records
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
-
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>
-
Andreas Kienast commented and changed status
NewAccepted <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. -
Andreas Kienast commented <span data-processor="relativetime" data-value="2025-04-10T14:23:45+00:00" > 04/10/25, 14:23 </span>
I’ve pushed a proof-of-concept patch, which basically works: https://review.typo3.org/c/Packages/TYPO3.CMS/+/89039
-
Gerrit Code Review pushed patch set 2 for main to change 89039 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2025-04-11T07:47:04+00:00" > 04/11/25, 07:47 </span> -
Gerrit Code Review pushed patch set 3 for main to change 89039 <span data-processor="relativetime" data-value="2025-04-22T08:47:33+00:00" > 04/22/25, 08:47 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 89201 <span data-processor="relativetime" data-value="2025-04-23T10:52:40+00:00" > 04/23/25, 10:52 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 89202 <span data-processor="relativetime" data-value="2025-04-23T10:53:34+00:00" > 04/23/25, 10:53 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %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.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:33:23+00:00" > 12/02/25, 14:33 </span>
Probably something with the web component re-initialisation for IRRE “hot reloading”