Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An editor receives sometime unfinished ClientEval options #3869

Open
jonnitto opened this issue Oct 17, 2024 · 0 comments
Open

An editor receives sometime unfinished ClientEval options #3869

jonnitto opened this issue Oct 17, 2024 · 0 comments

Comments

@jonnitto
Copy link
Member

jonnitto commented Oct 17, 2024

Description

Sometimes, the editor receives unfinished options with ClientEval strings prefixed.

If you have set the option hidden, (which is quite a often used case), the interface is flickering as another value change

Steps to Reproduce

Create a node type

'Foo.Bar:Content.Issue':
  superTypes:
    'Neos.Neos:Content': true
  ui:
    label: Issue
    icon: github
    inspector:
      groups:
        test:
          label: test
          icon: github
  properties:
    inline:
      type: string
      defaultValue: ''
      ui:
        inlineEditable: true
    checkbox:
      type: boolean
      defaultValue: true
      ui:
        label: Label
        inspector:
          group: test
    input:
      type: string
      ui:
        label: Label
        inspector:
          group: test
          hidden: 'ClientEval: !node.properties.checkbox'

and this Fusion

prototype(Foo.Bar:Content.Issue) < prototype(Neos.Neos:ContentComponent) {
    inline = Neos.Neos:Editable {
        property = 'inline'
    }

    renderer = afx`<div>{props.inline}</div>`
}

If you enter some text the input field in the inspector get's hidden and appears again

Expected behavior

No flickering

Actual behavior

CleanShot.2024-10-17.at.13.27.47.mp4

Note

If found this because I created an editor and log the options, and sometimes he get the options including ClientEval.

In the editor itself I can handle it like this:

function ClientEvalIsNotFinished(input) {
    if (!input) {
        return false;
    }
    if (typeof input == "string") {
        return input.includes("ClientEval:");
    }

    if (Array.isArray(input)) {
        return input.some((value) => ClientEvalIsNotFinished(value));
    }
    if (isObject(input)) {
        return ClientEvalIsNotFinished(Object.values(input));
    }
    return false;
}

function isObject(input) {
  return input != null && (input.constructor === Object || (!input.constructor && typeof input === 'object'));
}

But this will not work for the option hidden, which is one of the main use case for ClientEval

Affected Versions

Neos: 8.3.17

UI: 8.3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant