mosaico icon indicating copy to clipboard operation
mosaico copied to clipboard

Saved model is obsolete (bug with boolean values not named *Visible)

Open perlpty opened this issue 9 years ago • 9 comments

I just finished my base-template, and it works great. I can change anything I want, save, download, etc.

However, if I try to edit the a previous saved template from the same base-template, when clicking on edit it show a message saying:

"Saved model is obsolete" "The saved model has been created with a previous, non completely compatible version..."

I have not edited the base-template in between edit attempts, so I m sure the this issue is not related to a changed base-template.

Looking at the console window it shows a suspicious message: "Trying to compile an incompatible template version!" incompatible-template

The end-user experience is just a small window appearing with the above message. I must say again, this issue only happen when editing the template but not when creating it from scratch.

perlpty avatar Dec 11 '16 21:12 perlpty

I can be even more specific. This issue only happen to me when hiding elements in the editing-template using boolean variables like:

viewtitle { label: View Title?; widget: boolean; }
viewbutton { label: View Button?; widget: boolean; }
viewimage { label: View Image?; widget: boolean; }

I use them to hide some parts of the same box in a block. They are defined like this:

COL2PLANBlock PLAN1 {
	label: Plan 1;
	properties: viewtitle=true viewimage=true  viewbutton=true;	}

So, If I do not edit or do not hide then no error occurs.

I think this error is somehow weird since it only happens when editing and under hiding conditions.

perlpty avatar Dec 11 '16 22:12 perlpty

I see errors with "custom names", e.g: "COL2PRODUCTBlock" so I guess this happens with a custom template.

The problem is that it saved a string for "PRODUCT1.verboton" but the template defines a boolean (or viceversa): maybe this is a bug with some specific use case or maybe you defined something wrong... I can't tell if I can't reproduce it.

Please share the template or make changes to versafix-1 so that we can reproduce the issue.

bago avatar Dec 12 '16 08:12 bago

Ok. I m able to define a little better the issue. It is related to boolean values only. And only if they define a default value in the block definition (ie: properties: viewtitle=true).

And also seems to be related to the boolean name, since the issue only appears on boolean names not ending in "visible". All versafix boolean names ends in "visible", and it may be the reason why I don’t see the issue there. I think that because Only 1 of my boolean names is, in fact, visible and it does not show the issue, but the rest of them do.

It is like this: Boolean(no visible suffix) + default value = Issue appears Boolean(no visible suffix) without default value = No-Issue (but title won't appear at the beginning ) Non-boolean properties = No issue

In the mean time, I send you an extract of my template where this issue is exposed. For clarity, The template includes only 1 block, 1 image and minimum CSS and HTML code. The "edres" folder is also included so you don’t even have to run "makeThumbs". t2.zip

perlpty avatar Dec 12 '16 12:12 perlpty

Ok. Now, I can confirm. It is related to the name of the boolean property. For boolean names to work they must end on "Visible" or they would expose the above issue. The issue is like this:

vertitulo { label: Ver Titulo?; extend: visible; } ---> ISSUE APPEARS
tituloVisible { label: Ver Titulo?; extend: visible; } ---> NO ISSUE

here I send the same template as before, but only the boolean names changed.

t2-noissue.zip

Hope this info help you understand better the issue...

perlpty avatar Dec 12 '16 13:12 perlpty

OK, thank you.. i guess you just hit a "known" todo: https://github.com/voidlabs/mosaico/blob/master/src/js/converter/model.js#L260

bago avatar Dec 12 '16 14:12 bago

I took the time to write the Issue Exposing Procedure:

  1. For Template with this issue:

    • open Template

    • Load the only block available

    • Save Template

    • Return (hit top-left mosaico icon)

    • Edit That Template

    • Hide the button of Plan 1

    • Save Template

    • Return (hit top-left mosaico icon)

    • Edit That Template

    • Then, the Issue does appear. And the template is loaded with Plan1 button hidden.

  2. For Template without this issue (boolean names with Visible Suffix):

    • open Template

    • Load the only block available

    • Save Template

    • Return (hit top-left mosaico icon)

    • Edit That Template

    • Hide the button of Plan 1

    • Save Template

    • Return (hit top-left mosaico icon)

    • Edit That Template

    • Then, the Issue does not appear. And the template is loaded with Plan1 button hidden.

perlpty avatar Dec 12 '16 14:12 perlpty

Ok, I guess my last post was without seeing your last post. I suppose I would have to change all boolean variables to add the "Visible"... Is there any plan to fix this TODO any time soon?

perlpty avatar Dec 12 '16 14:12 perlpty

the plan is to fix it and I already assigned this to myself.. but I can't give an ETA.. it is not high priority as it is not blocking "paying customers" and there is a workaround (postfix them with Visibile). Futhermore IIRC I left that "TODO" because it was not easy to fix it, so this may be delayed to a major refactoring.. I can't tell by now without analyzing it better.

bago avatar Dec 12 '16 14:12 bago

Just to report back. I postfixes all boolean names and now it works without issue. And I agree, there is a workaround that works. Again, thanks for such a good software.

perlpty avatar Dec 12 '16 16:12 perlpty