Project

General

Profile

Actions

Bug #103168

closed

High index for custom template paths causes browser freezes in the Backend Form Editor

Added by Steffen Keuper 9 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2024-02-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

We use the current timestamp mostly for new template overrides to avoid accidental overlaps. While this works perfectly fine in TYPO3 it caused unexpected browser freezes in the backend form editor due to the parsing of the YAML file in JavaScript.

Example setup:

renderingOptions:
  submitButtonLabel: Submit
type: Form
identifier: test_1
label: test
prototypeName: standard
finishers:
  -
    options:
      subject: Test
      recipients:
        test@test.com: ''
      senderAddress: test@test.com
      senderName: ''
      addHtmlPart: true
      attachUploads: true
      title: ''
      templateName: 'Test{@format}.html'
      templateRootPaths:
        1708504268: 'EXT:forms_extended/Resources/Private/Emails/Templates'
      partialRootPaths:
        1708504268: 'EXT:forms_extended/Resources/Private/Emails/Partials'
    identifier: EmailToSender
renderables:
  -
    renderingOptions:
      previousButtonLabel: back
      nextButtonLabel: next
    type: Page
    identifier: page-1
    label: Step

This is caused by the usage of the reduce function on the JavaScript array in the core.js of the Backend Form Editor:
obj[firstPartOfPath] = obj[firstPartOfPath].reduce(
  function(converted, item, itemIndex) {
    converted[itemIndex] = item;
    return converted;
  },
  {}
);

This part causes JavaScript to go through all array cells, which with the current timestamp amount to 1.7 billion entries, causing the browser to freeze for multiple seconds.
The frontend works completely normal, only the Form Editor is affected by high template indexes.

Actions

Also available in: Atom PDF