mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-12 04:42:16 +00:00
The bake chain (getCompositeCanvasFile → runCompositeBake → getCompositeFile / scheduleCompositeBake → handleGenerate) used to rebuild every callback in the chain on every base-image change, because getCompositeCanvasFile listed baseImageBitmap/baseImageInfo as deps. Reading those via latest-refs makes getCompositeCanvasFile stable (deps []) and the cascade collapses — listed deps remain (lint-clean) but never trigger recreates. Also list baseImageInfo explicitly in the dirty-effect deps so cache invalidation no longer relies on the cascade's identity changes (baseImageInfo syncs synchronously in setBaseImageInfo, but baseImageBitmap arrives async after the image loads, so the two diverge in time). Wrap getMaskArrayBuffer in useCallback([]) so handleGenerate can list it as a dep without churning per render.