hot-reload: clean backup only after it's been consumed

This commit is contained in:
jean-emmanuel 2018-10-20 15:23:01 +02:00
parent 274a035ea9
commit cb13fcafde
2 changed files with 14 additions and 2 deletions

View file

@ -24,7 +24,6 @@ module.exports = {
if (data.backupId && sessionBackups[data.backupId]) {
ipc.send('loadBackup', sessionBackups[data.backupId])
delete sessionBackups[data.backupId]
return
}
@ -315,6 +314,12 @@ module.exports = {
},
deleteBackup: function(data) {
delete sessionBackups[data]
},
reloadCss:function(){
theme.load()
ipc.send('reloadCss')

View file

@ -140,12 +140,19 @@ module.exports = {
loadBackup: function(data) {
session.load(data.session, ()=>{
state.set(data.state, false)
editor.historySession = deepCopy(data.session)
editor.history = data.history
editor.historyState = data.historyState
if (data.sidepanelOpened) sidepanel.open()
if (data.editorEnabled) editor.enable()
if (data.sidepanelOpened) sidepanel.open()
ipc.send('deleteBackup', data.backupId)
})
}