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

Live preview contains old data #246

Open
vntw opened this issue May 5, 2023 · 0 comments
Open

Live preview contains old data #246

vntw opened this issue May 5, 2023 · 0 comments
Labels
Bug Error or unexpected behavior of already existing functionality

Comments

@vntw
Copy link

vntw commented May 5, 2023

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.

$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.

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.

  1. Create example content and save
  2. Edit example content text
  3. Live preview ("as you type") will only show old data until you either save as draft or publish
@alexander-schranz alexander-schranz added the Bug Error or unexpected behavior of already existing functionality label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants