Skip to content

fix(ui): synchronize swipe action gesture handlers with latest props#31

Open
arnauda-gh wants to merge 1 commit into
bulwarkmail:mainfrom
arnauda-gh:fix/swipe-action-desync
Open

fix(ui): synchronize swipe action gesture handlers with latest props#31
arnauda-gh wants to merge 1 commit into
bulwarkmail:mainfrom
arnauda-gh:fix/swipe-action-desync

Conversation

@arnauda-gh

@arnauda-gh arnauda-gh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #30

Summary

Fixes an issue where modifying swipe action configuration in settings (e.g. changing action to delete) caused already-mounted email list rows to visually update their rendered layer (showing Trash icon and red background), but execute the stale action (mark as read) when performing the swipe gesture.

Solution

  • Maintained mutable useRef instances (leftActionRef, rightActionRef, modeRef, onActionRef) inside SwipeableRow.
  • Updated PanResponder gesture callbacks (onMoveShouldSetPanResponder, onPanResponderMove, onPanResponderRelease, fly, fireFromBandTap) to read .current from these refs.
  • Added unit test in src/components/__tests__/SwipeableRow.test.ts verifying dynamic prop updates on mounted rows.

!! AI WARNING !! : This PR was generated and created by AI. It has been tested on my own use case and seems to work. However have a deep look about the generated code.

Note that the issues was a bit more deep that the AI detected. I think that the settings about the swipe action where fetch after the swipe mount. In fact even if we didn't changed manually the setting the swipe action (depending on the connexion efficiency) not work even without changes.

Fixes bulwarkmail#30.

PanResponder in SwipeableRow was created once on mount and captured initial props in a stale closure. Using mutable refs ensures gesture handlers always read and execute the latest leftAction, rightAction, mode, and onAction props.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ui): swipe action gesture handlers desynchronized on prop updates

1 participant