neos-development-collection icon indicating copy to clipboard operation
neos-development-collection copied to clipboard

Regression 8.0 Fusion `DataStructure` omits `null` value in rare case

Open mhsdesign opened this issue 2 years ago • 2 comments

In Neos 7.3 this rendered to

root = Neos.Fusion:Component {
  somePathWithPlainNull = null
  renderer = Neos.Fusion:DataStructure {
    key = ${props.somePathWithPlainNull}
  }
}
{"key": null}

but similar to https://github.com/neos/neos-development-collection/issues/3859 probably since 8.0 change https://github.com/neos/neos-development-collection/pull/3645 in the result the key "key" is completely omitted:

{}

Similar to https://github.com/neos/neos-development-collection/pull/3677 this is a problem with the global use of the "$lastEvaluationStatus" flag.

I traced the problem down to:

Before the eel expression is evaluated evaluateExpressionOrValueInternal the evaluation status is set to "EXECUTED", but inside the eel expression via "props.somePathWithPlainNull" we trigger a side effect because this lazy prop is evaluated and because fusion finds nothing useful in "somePathWithPlainNull" it sets the status to "SKIPPED".

Because of that we skip the value in the data-structure: https://github.com/neos/neos-development-collection/blob/132321889aeeca17caa2a6f3117e1fbc8e8a5a9e/Neos.Fusion/Classes/FusionObjects/AbstractArrayFusionObject.php#L133-L135

related problem: that fusion has no good concept of null. The assigned values = null and = ${null} are treated internally completely different.

mhsdesign avatar Sep 11 '23 07:09 mhsdesign

I thought that was intentional to basically allow unsetting keys, eg. for css class merging?

kitsunet avatar Sep 11 '23 07:09 kitsunet

has to be retested after https://github.com/neos/neos-development-collection/pull/5033

mhsdesign avatar Jun 16 '24 15:06 mhsdesign