contentful / experience-builder

https://www.contentful.com/developers/docs/experiences/what-are-experiences/
MIT License
5 stars 1 forks source link

fix: render default content values for patterns [SPA-2048] #580

Closed SofiaMargariti closed 3 weeks ago

SofiaMargariti commented 3 weeks ago

Purpose

When rendering a pattern in the editor, as a standalone pattern, outside of an experience, we need to still render the default (placeholder) values into the canvas to assist designers when adjusting the pattern.

Approach

This PR makes sure that when we encounter a property with type ComponentValue (only available for patterns) we render the default value of the component.

Before

Screenshot 2024-04-24 at 11 02 58

After

Screenshot 2024-04-24 at 11 03 59
vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
experience-builder-test-app ✅ Ready (Inspect) Visit Preview Apr 26, 2024 1:18pm
Spring3 commented 3 weeks ago

@SofiaMargariti do we want to fix that for delivery/preview as well?

At the moment it is fixed only for editor mode

Screenshot 2024-04-26 at 15 02 52

SofiaMargariti commented 3 weeks ago

@SofiaMargariti do we want to fix that for delivery/preview as well?

At the moment it is fixed only for editor mode

Screenshot 2024-04-26 at 15 02 52

🤔 I can apply the same fix.. although should we support preview/delivery for patterns?

Spring3 commented 3 weeks ago

@SofiaMargariti do we want to fix that for delivery/preview as well? At the moment it is fixed only for editor mode Screenshot 2024-04-26 at 15 02 52

🤔 I can apply the same fix.. although should we support preview/delivery for patterns?

Not certain myself, but also why not? Default values have been provided but we are not rendering them. If I created an experience and used this pattern, it would render a pattern with default values (in both - editor and preview/delivery). So why not do so for the pattern itself 🤔

SofiaMargariti commented 3 weeks ago

I've updated the PR for preview/delivery mode as well, thanks everyone.