remove extra block in viz [pr] (#9115)

This commit is contained in:
qazal
2025-02-16 02:38:09 +02:00
committed by GitHub
parent fd95543ff1
commit 2e97022e5e
+22 -24
View File
@@ -349,36 +349,34 @@
});
// ***** UOp graph
if (currentKernel == -1) return;
const cacheKey = `${currentKernel}-${currentUOp}`;
if (cacheKey in cache) {
ret = cache[cacheKey];
}
else {
const cacheKey = `${currentKernel}-${currentUOp}`;
if (cacheKey in cache) {
ret = cache[cacheKey];
const p = document.querySelector(".progress");
p.style.display = "none";
const limit = 100;
const pageCount = Math.ceil((kernels[currentKernel][1][currentUOp].match_count+1)/limit);
if (pageCount > 1) {
p.style.display = "flex";
d3.select("#graph-svg g").selectAll("*").remove();
}
else {
const p = document.querySelector(".progress");
p.style.display = "none";
const limit = 100;
const pageCount = Math.ceil((kernels[currentKernel][1][currentUOp].match_count+1)/limit);
if (pageCount > 1) {
p.style.display = "flex";
d3.select("#graph-svg g").selectAll("*").remove();
}
for (let i=0; i < pageCount; i++) {
p.innerText = `fetching data ${i+1}/${pageCount}`;
const chunk = await (await fetch(`/kernels?kernel=${currentKernel}&idx=${currentUOp}&offset=${i*limit}&limit=${limit}`)).json();
if (i === 0) ret = chunk
else {
// TODO: this shouldn't exist after the viz api refactor
for (const [k,v] of Object.entries(chunk)) {
if (Array.isArray(v) && k !== "loc") ret[k].push(...v);
}
for (let i=0; i < pageCount; i++) {
p.innerText = `fetching data ${i+1}/${pageCount}`;
const chunk = await (await fetch(`/kernels?kernel=${currentKernel}&idx=${currentUOp}&offset=${i*limit}&limit=${limit}`)).json();
if (i === 0) ret = chunk
else {
// TODO: this shouldn't exist after the viz api refactor
for (const [k,v] of Object.entries(chunk)) {
if (Array.isArray(v) && k !== "loc") ret[k].push(...v);
}
}
p.style.display = "none";
cache[cacheKey] = ret;
}
renderGraph(ret.graphs[currentRewrite], ret.changed_nodes[currentRewrite]);
p.style.display = "none";
cache[cacheKey] = ret;
}
renderGraph(ret.graphs[currentRewrite], ret.changed_nodes[currentRewrite]);
// ***** RHS metadata
const metadata = document.querySelector(".container.metadata");
metadata.innerHTML = "";