tracker: slight update to use iconCache for spritemaps

This commit is contained in:
nick-delirium 2025-05-30 14:51:02 +02:00
parent f402a44e18
commit 1d113174e4
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0

View file

@ -43,6 +43,15 @@ async function parseUseEl(
let [url, symbolId] = href.split('#') let [url, symbolId] = href.split('#')
if (!url && !symbolId) {
console.warn('Openreplay: Invalid xlink:href or href found on <use>.')
return
}
if (iconCache[symbolId]) {
return iconCache[symbolId]
}
// happens if svg spritemap is local, fastest case for us // happens if svg spritemap is local, fastest case for us
if (!url && symbolId) { if (!url && symbolId) {
const symbol = document.querySelector(href) const symbol = document.querySelector(href)
@ -61,16 +70,6 @@ async function parseUseEl(
return return
} }
} }
if (!url && !symbolId) {
console.warn('Openreplay: Invalid xlink:href or href found on <use>.')
return
}
if (iconCache[symbolId]) {
return iconCache[symbolId]
}
let svgDoc: Document let svgDoc: Document
if (svgUrlCache[url]) { if (svgUrlCache[url]) {
if (svgUrlCache[url] === 1) { if (svgUrlCache[url] === 1) {