🐛 Site > Fix crash when current project is destroyed

This commit is contained in:
brunosimon
2017-12-25 21:44:14 +01:00
parent b5d11bdde0
commit fd73d567cf
4 changed files with 13 additions and 7 deletions
+4 -1
View File
@@ -65,9 +65,12 @@ export default
return
}
// Set null file
// Reset file
this.$store.commit('setFile', null)
// Reset messages
this.$store.commit('emptyMessages', null)
// If was connected to another socket
if(this.projectSocket)
{
+5
View File
@@ -13,6 +13,11 @@ export default {
mutations:
{
emptyMessages(state)
{
state.messages = []
},
createMessage(state, data)
{
state.messages.push(data)
+2 -1
View File
@@ -17,7 +17,8 @@ export default {
// Current project has been removed
if(typeof state.all[state.current.slug] === 'undefined')
{
state.current = null
const projectKeys = Object.keys(state.all)
state.current = state.all[projectKeys[0]]
}
}