Fixed unused map source being set on peer map data

This commit is contained in:
Mitchell McCaffrey 2020-04-25 00:43:15 +10:00
parent 6e8cb833aa
commit 671c8d7bf7

View File

@ -186,12 +186,10 @@ function Game() {
}
}
if (data.id === "map") {
// If we have a file convert it to a url
// TODO clear the file url of the previous map if it's a blob
if (data.data && data.data.file) {
if (data.data && data.data.type === "file") {
// Convert file back to blob after peer transfer
const file = new Blob([data.data.file]);
const source = URL.createObjectURL(file);
setMap({ ...data.data, file, source });
setMap({ ...data.data, file });
} else {
setMap(data.data);
}