Repository navigation
refactor(log-viewer): share the pixi app and mesh setup - #1090
Merged
lcottercertinia merged 3 commits intoSep 29, 2026
Merged
Conversation
FlameChart, MetricStripOrchestrator and MinimapOrchestrator each held the same ten lines of Pixi app setup, differing only in height and antialias. They now call createTimelineApp, beside the destroyTimelineApp they already shared. `this.app` is assigned after init() resolves rather than before the await. Nothing reads it during that window: FlameChart wires its ResizeObserver only after the first render, and TimelineFlameChart guards teardown with an init epoch rather than racing it. Where it would matter it is safer — resize() guards on `!this.app`, and the old code could reach a Pixi app that had not been initialised. pixiApp.ts imports pixi as a value now. Its only three importers already did, and no bundler config makes pixi a lazy chunk.
MeshRectangleRenderer, MeshMarkerRenderer, MeshSearchStyleRenderer and MeshAxisRenderer each built the same geometry, shader, mesh, label and addChild sequence. They now call createRectangleMesh. The helper owns the shader, so the four `private shader` fields go. Each was assigned once and never read again, and no destroy() released it. Holding it was a small leak: Mesh.destroy() nulls its own reference, so the field kept the shader alive after the mesh was gone. MinimapRenderer builds a fifth mesh and is left alone. It uses MinimapBarGeometry, takes no label and adds itself to a container later.
lcottercertinia
marked this pull request as ready for review
September 29, 2026 09:35
lcottercertinia
approved these changes
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 PR Overview
The timeline built three Pixi apps and four rectangle meshes from copies of the same
setup. Each now has one home in
optimised/rendering/. No behaviour change.Draft until the dev host check below is done. A missing renderer here fails silently —
the canvas simply comes up empty — and neither jest nor
pnpm measurecan see it.🛠️ Changes made
share the pixi app setup—FlameChart,MetricStripOrchestratorandMinimapOrchestratoreach held the same ten lines, differing only inheightandantialias. They now callcreateTimelineApp, beside thedestroyTimelineApptheyalready shared.
antialiasdefaults off; only the metric strip draws lines thatneed it.
share the pixi mesh construction—MeshRectangleRenderer,MeshMarkerRenderer,MeshSearchStyleRendererandMeshAxisRenderereach built thesame geometry, shader, mesh, label and
addChildsequence. They now callcreateRectangleMesh.Two differences worth stating
this.appis assigned afterinit()resolves, where beforethis.app = new PIXI.Application()set a not-yet-initialised app ahead of theawait. Nothing reads it in that window:FlameChartwires itsResizeObserveronly after the first render, and
TimelineFlameChartguards teardown with an initepoch rather than racing it. Where it would matter it is safer —
resize()guards on!this.app, and the old code could reach an app that had not been initialised.private shaderfields are gone, since the helper owns the shader. Eachwas assigned once, never read again, and no
destroy()released it. Holding it was asmall retention:
Mesh.destroy()nulls its own reference, so the field kept theShaderalive after the mesh was already gone.pixiApp.tsimports pixi as a value now rather than as a type. Its only threeimporters already did, and no bundler config makes pixi a lazy chunk.
Left out on purpose
minimap/MinimapRenderer.tsbuilds a fifth mesh and is untouched. It usesMinimapBarGeometry, takes no label, and adds itself to a container later.BUCKET_BLOCKderivation is still written twice. It is five lines ofstraight-line arithmetic over two exported constants, with nothing that can drift
between the sites, and two of its four original sites are deleted by refactor: remove dead code and share test setup #1066. Better
revisited once that lands and the surviving count is settled.
🧩 Type of change (check all applicable)
📷 Screenshots / gifs / video [optional]
None yet. The dev host pass below is what would produce them.
🔗 Related Issues
None. Touches none of the files #1066 deletes, so the two are independent.
✅ Tests added?
Both changes are construction-time Pixi code with no testable behaviour of their own,
and the existing suites cover the renderers that use them.
pnpm testis green at2,625 tests across 191 suites, with
pnpm exec tsc -b --forceandpnpm exec eslintclean.
There is no automated check that can cover this.
scripts/measure/measure.ts:8saysits harness is "free of the DOM and of PixiJS, so they run under Node", and jest runs
under jsdom with no WebGL. Hence the manual pass.
📚 Docs updated?
Nothing reachable by a user changes.
Anything else we need to know? [optional]
Dev host check, required before this leaves draft. Open a
sample-app/log andconfirm on the timeline tab that all six draw:
antialias: true