mirror of
https://github.com/quartz-community/graph.git
synced 2026-07-22 02:50:25 +00:00
fix: destroy PixiJS app on prenav to avoid WebGL context loss
Cleanup now runs on the prenav event (before SPA navigation starts) while the WebGL context is still valid, eliminating the TexturePool errors during app.destroy(). The try/catch remains as a silent safety net for edge cases.
This commit is contained in:
parent
05bf33de90
commit
c54226d895
5 changed files with 10 additions and 8 deletions
2
dist/components/index.js
vendored
2
dist/components/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/components/index.js.map
vendored
2
dist/components/index.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -592,10 +592,8 @@ import {
|
|||
simulation.stop();
|
||||
try {
|
||||
app.destroy(true);
|
||||
} catch (e) {
|
||||
// PixiJS may throw if WebGL context was already lost (e.g. during SPA navigation).
|
||||
// Swallow the error so cleanup completes and the graph can re-render.
|
||||
console.warn("[Graph] PixiJS destroy failed (WebGL context likely lost):", e);
|
||||
} catch (_) {
|
||||
// PixiJS may throw if WebGL context was already lost.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -766,6 +764,10 @@ import {
|
|||
} else {
|
||||
handleNav({ detail: { url: getSlugFromUrl() } });
|
||||
}
|
||||
document.addEventListener("prenav", function () {
|
||||
cleanupLocal();
|
||||
cleanupGlobal();
|
||||
});
|
||||
document.addEventListener("nav", handleNav);
|
||||
document.addEventListener("render", handleNav);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue