Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
perlpty opened this issue Dec 11, 2016 · 9 comments
Open
Assignees
Labels

Comments

@perlpty
Copy link

perlpty commented Dec 11, 2016

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
Copy link
Author

perlpty commented Dec 11, 2016

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.

@bago
Copy link
Member

bago commented Dec 12, 2016

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 bago added the bug label Dec 12, 2016
@perlpty
Copy link
Author

perlpty commented Dec 12, 2016

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
Copy link
Author

perlpty commented Dec 12, 2016

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...

@bago
Copy link
Member

bago commented Dec 12, 2016

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

@perlpty
Copy link
Author

perlpty commented Dec 12, 2016

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.

@bago bago self-assigned this Dec 12, 2016
@bago bago added this to the 0.16 milestone Dec 12, 2016
@perlpty
Copy link
Author

perlpty commented Dec 12, 2016

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?

@bago
Copy link
Member

bago commented Dec 12, 2016

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.

@perlpty
Copy link
Author

perlpty commented Dec 12, 2016

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.

@bago bago changed the title Saved model is obsolete Saved model is obsolete (bug with boolean values not named *Visible) Jan 31, 2017
@bago bago modified the milestones: 0.16, 0.17 Mar 20, 2017
@bago bago modified the milestones: 0.17, 0.18 Feb 28, 2018
@bago bago removed this from the 0.18 milestone Apr 27, 2022
UshaMakoa pushed a commit to MAKOA-France/CiviVersafix-FR that referenced this issue Feb 10, 2023
Fixes #2

See [this upstream GitHub issue](voidlabs/mosaico#249) for discussion/info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants