WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Live preview contains old data #246

@vntw

Description

@vntw

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError or unexpected behavior of already existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions