mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 00:05:50 +01:00
refactor(geomap): avoid parsing XML twice
This commit is contained in:
@@ -224,13 +224,12 @@ export default class GeoMapTypeWidget extends TypeWidget {
|
||||
this.gpxLoaded = true;
|
||||
}
|
||||
|
||||
const xmlResponse = await server.get<XMLDocument | Uint8Array>(`notes/${note.noteId}/open`);
|
||||
const xmlResponse = await server.get<string | Uint8Array>(`notes/${note.noteId}/open`, undefined, true);
|
||||
let stringResponse: string;
|
||||
if (xmlResponse instanceof Uint8Array) {
|
||||
stringResponse = new TextDecoder().decode(xmlResponse);
|
||||
} else {
|
||||
// TODO: This is not very efficient as it's probably a string response that is parsed and then converted back to string and parsed again.
|
||||
stringResponse = new XMLSerializer().serializeToString(xmlResponse)
|
||||
stringResponse = xmlResponse;
|
||||
}
|
||||
|
||||
const track = new this.L.GPX(stringResponse, {});
|
||||
|
||||
Reference in New Issue
Block a user