fixed a load bug that could lead to inconsistently versioned indexes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-01-22 02:58:34 +03:00
parent 3c6eddb6f4
commit 835fc0492d
3 changed files with 17 additions and 5 deletions

View File

@ -1214,6 +1214,10 @@ core.ImageGridFeatures.Feature({
function(){ this.markChanged('all') }], function(){ this.markChanged('all') }],
// data... // data...
['load',
function(){
this.data.version_updated
&& this.markChanged('all') }],
[[ [[
//'load', //'load',

View File

@ -979,7 +979,11 @@ module.FileSystemLoader = core.ImageGridFeatures.Feature({
var that = this var that = this
res.then( res.then(
function(){ function(){
that.markChanged('none') }, // NOTE: this repeats the functionality in
// base.js' 'edit' feature...
that.data.version_updated ?
that.markChanged('all')
: that.markChanged('none') },
function(){}) } }], function(){}) } }],
// mark everything changed when loading images... // mark everything changed when loading images...
['loadImages', ['loadImages',
@ -2549,10 +2553,7 @@ module.FileSystemWriter = core.ImageGridFeatures.Feature({
//this.markChanged('none') //this.markChanged('none')
var that = this var that = this
res.then(function(){ res.then(function(){
that.markChanged('none') that.markChanged('none') }) } }],
})
}
}],
], ],
}) })

View File

@ -2723,7 +2723,14 @@ var DataPrototype = {
load: function(data, clean){ load: function(data, clean){
var that = this var that = this
data = typeof(data) == typeof('str') ? JSON.parse(data) : data data = typeof(data) == typeof('str') ? JSON.parse(data) : data
var version = data.version
data = formats.updateData(data, DATA_VERSION) data = formats.updateData(data, DATA_VERSION)
// report version change...
delete this.version_updated
if(data.version != version){
this.version_updated = true }
this.order = data.order.slice() this.order = data.order.slice()
this.ribbon_order = data.ribbon_order.slice() this.ribbon_order = data.ribbon_order.slice()