Files
mule-image/frontend
dtoro 7bb03be51a fix: stable preview nav handlers via ref
react-hotkeys-hook can fire a stale closure when the callback dependency
array changes between renders, causing arrow nav to read an old photos
array (e.g. the empty initial render before visiblePhotoIds was applied)
and land on the wrong photo or no-op entirely.

Move the latest photos / activePhotoId into a navRef updated on every
render. The goPrev / goNext callbacks become stable (their useCallback
deps shrink to just setActivePhoto) and read the freshest values from
the ref at fire time. useHotkeys no longer has to re-bind on every
render — the handlers can capture the ref once.

The visible-order array still drives navigation; this just removes the
re-bind race that was making it look like nav was ignoring it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 22:07:46 +02:00
..
2026-04-06 23:30:19 +02:00
2026-04-06 23:30:19 +02:00
2026-04-07 00:15:00 +02:00
2026-04-07 00:15:00 +02:00
2026-04-06 23:30:19 +02:00
2026-04-06 23:30:19 +02:00
2026-04-06 23:30:19 +02:00
2026-04-06 23:30:19 +02:00