fix legacy migration:
use index instead of timestamp to avoid duplicates add a warning message
This commit is contained in:
parent
095bc6dd42
commit
8d0b4bef5e
7
main.js
7
main.js
|
@ -1264,14 +1264,15 @@ function migratelegacystorage()
|
|||
var legacy = localStorage.getItem("data");
|
||||
if (legacy)
|
||||
{
|
||||
var legacy = JSON.parse(legacy);
|
||||
alert("Old data model detected. Click ok to migrate, or close app.")
|
||||
legacy = JSON.parse(legacy);
|
||||
var index = {};
|
||||
legacy.reverse().forEach(note =>
|
||||
legacy.reverse().forEach( (note, i) =>
|
||||
{
|
||||
var guid = genguid();
|
||||
localStorage.setItem(guid, note.content);
|
||||
note.header = indexheader(note.content);
|
||||
note.lastchanged = Date.now();
|
||||
note.lastchanged = i;
|
||||
delete note.content;
|
||||
index[guid] = note;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue