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 (data.id === "map") {
// If we have a file convert it to a url if (data.data && data.data.type === "file") {
// TODO clear the file url of the previous map if it's a blob // Convert file back to blob after peer transfer
if (data.data && data.data.file) {
const file = new Blob([data.data.file]); const file = new Blob([data.data.file]);
const source = URL.createObjectURL(file); setMap({ ...data.data, file });
setMap({ ...data.data, file, source });
} else { } else {
setMap(data.data); setMap(data.data);
} }