Master pages > Optional > Restore on update

Hi,

I have started using Master pages and smart components, I don’t think the Restore on update is working as per the documentation / tutorials.

I am experiencing deleted components reappearing in child pages - after a component update, even though the components are marked as optional in the master and their restore on update is left unchecked.

My system details:

  • Mac OS Catalina: 10.15.7
  • Pinegrow: 5.99

Steps to reproduce:

  1. Create components from elements in the DOM on index.html
  2. Select index.html to become a master page
  3. Reselect components in index.html and make them optional, leave restore on update unchecked
  4. Save and reload components
  5. Create a new page based on master (index.html), e.g. about.html
  6. Delete the optional components from about.html and save
  7. Edit a component on master and then update components
  8. All deleted ‘optional’ components from about.html have been restored! Not the documented behaviour.

Many thanks for looking at this.

Tim

i’ve had similar difficulties but gained a better understanding of how these features work

hope this helps.

Thanks droidgoo, I have tried what Matjaz suggested in his response to you… which hasn’t made a difference. The issue is more to do with the Optional > Restore on update not functioning in the desired way.

I followed this tutorial: Using Master pages in a multi-page project | Pinegrow Web Editor

I have been in touch with support and submitted my project asking for help.

the restore function is confusing, esp with optional areas.

the main takeway is the optional areas are NOT shown by default, and will “appear” whenever you update if you have the box checked.

here is a screen shot of the guide i made for myself to keep me from getting confused… hope it helps.

Hi Droidgoo,

Thanks for the note… the default optional behaviour you describe is not what is happening. All elements marked as optional are appearing in new instances of my master document when the new instance is created.

See image below that shows optional area being defined in the master document

See image below that shows a new instance of the master document but with the optional area still there

If I delete this optional element in my new instance… it then reappears when I do an update of components. Even though restore on update is left unchecked.

Thanks again for your help.

Tim

EDIT: Got the zip from the support ticket, sorry and thanks!
Hi @timbowerbank,
Could you provide me with a zip file of your project. Recreating a problem like this can be a little difficult.
Thanks,
Bob

Hi @timbowerbank,
Sorry for the slight delay in getting back to you. I will mostly likely make either a tutorial, or at least clarify the documentation on a couple of points.

Explanation of the issue

The problem you are running into on your page is a conflict between “Master” page rules and “Component” rules. Let me try to explain. Master pages expect everything to be duplicated on child pages, except for the items marked optional. Likewise, Components expect all the elements within the definition to be used except those marked as optional. On your pages you are adding optional to the main definition. That optional is supposed to be a signal to the Master page that the particular block of code can be deleted. Instead, Pinegrow is interpreting it as an optional signal to the definition. When you update, the Master detects that elements (not marked optional) have been deleted and puts them back.

The solution

So, how can this be fixed? I guess the main question is whether you need components.

Without Components

If not, you can just remove the “Component definition” action from each section, leaving the optional behind. Any Child page would then have everything the Master page has with the ability to delete any optional section that isn’t desired. The one issue with this method is that when you first create a Child page you will have to open the “Page” menu and select “Restore optional areas”

With Components

If you need to components you will have to take a slightly different route. The page where you define your components shouldn’t be the same as your Master page. Instead, you can duplicate your Master page and give it a new name. Next remove the Master page action. This page is now a factory page - it produces your components. Next, on the Master page you can add each section you want through the “Use component” action. These can now be marked as optional - this will apply at the Master page level so you can delete any section and it won’t reappear on Component update.

I hope this makes sense and helps you move forward with your project. Reach out if you still have questions or want clarification.

Cheers,
Bob

Hi Bob,

Thanks for the detailed reply, I’ll separate out my components on to a factory page as suggested. I hadn’t come across factory pages and components in the docs - so a tutorial would be good.

Thanks again,

Tim