craftcms / craftcms/cms

[5.x]: Live Preview not reflecting unsaved changes made without live preview

Open
#16,967 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

This is kind of a weird title, but I am facing the problem that live preview is not properly updating when making changes with live preview closed.

Live Preview itself is working fine when changes are being made while Live Preview is open.

Steps to reproduce
  1. Place a new content module on a site (in this case, a Text Input inside a Matrix field)
  2. Type "Headline goes here" in it
  3. Open Live Preview and notice that the preview renders properly
  4. While Live Preview is open, change the text to "Headline from Live Preview goes here" and see the changes being reflected just fine
  5. Close live preview, notice that the Text Input field is updated with the new Text from Live preview
  6. With Live Preview closed, change the text to "Headline from outside Live Preview goes here"
  7. Don't save the entry
  8. Open Live preview and notice that it's still showing the old text without "outside", both in the Text Input Field and also in the rendered preview
  9. Close the live preview again, notice that the value in the text field still correctly shows the new value
  10. Save the entry
  11. Open Live preview again, notice the new text appearing
Expected behavior

I guess, I'd expect Live Preview to reflect the current content state I entered, no matter if I saved it or not.

Actual behavior

Some kind of discrepancy, see Steps to Reproduce.

Craft CMS version

Craft Pro 5.6.10.2

PHP version

8.2.28

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Please note that we are using MatrixExtended — https://plugins.craftcms.com/matrix-extended?craft5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Craft CMS 5.6.10.2 using a new Text Input inside a Matrix field, following the listed steps with Live Preview opened and closed. Trace how unsaved edits made while preview is closed reach Live Preview, then verify that the current unsaved text appears in both the field and rendered preview before saving.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
full-stack
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.