-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hey,
the preview doesn't display the updated data while you're typing as it is the case for pages and articles from the article bundle.
One place where I can see that new data is overwritten by old data is the TemplateDataMapper. $localizedData contains the new data since the changed field is localized but the $unlocalizedData will contain all fields even if they're not localized.
SuluContentBundle/Content/Application/ContentDataMapper/DataMapper/TemplateDataMapper.php
Lines 79 to 80 in b5c3eeb
| $localizedDimensionContent->setTemplateData($localizedData); | |
| $unlocalizedDimensionContent->setTemplateData($unlocalizedData); |
The $localizedDimensionContent and $unlocalizedDimensionContent will refer to the same dimension content since the PreviewDimensionContentCollection always returns the same instance, so calling setTemplateData has an overwrite effect.
SuluContentBundle/Content/Infrastructure/Sulu/Preview/PreviewDimensionContentCollection.php
Lines 56 to 59 in b5c3eeb
| public function getDimensionContent(array $dimensionAttributes): ?DimensionContentInterface | |
| { | |
| return $this->previewDimensionContent; | |
| } |
I'm not too familiar with the way this bundle works/should work, so finding the solution is difficult 😅
When I quickly hack in a workaround where $unlocalizedData only contains unlocalized data, it seems to work but I'm pretty sure this alone might not be sufficient.
Steps
Reproduction: https://github.com/vntw/sulu-reproduction/tree/repro
This uses the sulu-skeleton (2.5 branch) with the example test application from the content-bundle.
- Create example content and save
- Edit example content text
- Live preview ("as you type") will only show old data until you either save as draft or publish