#Live Preview receives data without locale fallback

8 messages · Page 1 of 1 (latest)

quartz sandal
#

Normally with Payload you have an automatic locale fallback - meaning fields not present in the current locale will be filled with the content from the default-locale.

With Live Preview i have the problem, that the message posted from Payload to the frontend is without that fallback - meaning fields, that that should be filled with content from the fallback-language are suddenly empty. This is annoying, since during editing the editor does not actually see how the page will be rendered live. E.g. if the editor wants to keep a text field empty in a secondary locale, since he wants it to fall back to default language, it will be empty during live preview.

Is there any way to make Payload post the message with proper language fallback?

astral salmonBOT
regal elbow
#

HEy @quartz sandal currently, there is not a way to do this OOTB as far as I know.

the live preview message is built from the raw form state in the admin UI and sent via postMessage() to the preview iframe. It only includes locale — fallbackLocale is never included in the message

#

if you want to open a discussion on github—we'd need to update our logic to include fallbackLocale in the live preview message

quartz sandal
#

Hey @regal elbow , many thanks for your answer! ❤️ Yes, i thought that to be the case. Probably not so easy to solve. I'll open a GitHub discussion.

quartz sandal
regal elbow
#

I can't be certain, but I think I might have just found a typo in handleEndpoints

url += &fallbackLocale=${data.depth} // should be data.fallbackLocale

#

this would be one piece of the puzzle - we would still need to pass fallbackLocale in the live preview postMessage