The preview could not load ... components stuck?

Hey Themeco Team,

after cleaning up some Components one of my components page throws the “The preview could not load …” message. It might have happend after renaming the Components page, but I’m not sure, since I was heavily working with Components.

WordPress: v6.3
Pro Theme: v6.3.8
All other plugins are deactivated.

Any chance to have a look on this? Or any tips on how to get this component unstuck?

By un-exporting the used child components step-by-step I was able to get into the component page again. I will investigate further, how to fix this, since it might be helpful to others.

@ThemecoSupport So for now no need to login to my site,

Hi @raye,

Glad to know that you are able to get into it. Please let us know if you need any further help with this.

Thanks

Ok, now this is suprising, and I ask myself (and you) if this is a bug:

It seems paramater key names must be unique throughout the whole site cause the scope of parameter keys is somewhat “blurry”? Or is this an official requirement I missed in the docs? A simple example:

In Cornerstone create a new Component page and create a headline with a simple parameter JSON like this:

{
    "headline" : "My headline text"
}

Then connect the parameter as intended to the Content by using

{{dc:param:headline}}

In the Element Manager check the export, so that we can use that headline in a different component. Nothing special so far. The usual component creation process.

But now in Cornerstone create a second component page. Create a section and add the exported headline from above. Now open the Element Manager of the section, click Edit Parameters and again add the following JSON:

{
    "headline" : "My Section headline"
}

Attention: same key headline as in the element above.

Now open the headline element in that section and again use the following parameter as above:

{{dc:param:headline}}

Now after a Save and Reload I get the infamous “The preview could not load …” error.
But if I rename the last parameter key to something else (i.e. headline2) everything works.

So it seems the parameter keys do collide here.

If this behaviour is as intended, it is crucial to always use unique parameter key names throughout the whole site to avoid such a collision. I hope, that this is not the case, cause on a very large projects with lots of components this will get hard to fullfil … well maybe with a good structured naming convention like this:

{
    "componentNameMyHeadline" : "My Section headline"
}

But if you rename a component page the name does not fit anymore (but at least it still works).

Sorry for bumping this up, but I think it is important to know, if this is a bug (what I believe it is)?
And if it is not a bug, we have to be very careful about choosing parameter names, cause breaking Pro seems to be quite easy now.

If it is easier for you, I can also create a video.

Again, sorry for pushing (not quite my style).

Right now in that instance when assigning the parameter to it’s own dynamic content it’ll just create an infinite loop where it is referencing itself as you have experienced. We can set it up to look through the parent parameters in these cases for 6.4. I would probably setup your parent parameters to have a different name, and use something like {{dc:p:parentText fallback='text'}}, using the fallback argument for now. Have a great day!

1 Like

Thank you for having an eye on this. Everything that prevents an error by accident should make Cornerstone even better.

Hi @raye,

Yes, we appreciate your feedback, which makes Cornerstone better.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.