feat: implement touch event deduplication to prevent double-triggers (#330)#528
Open
daddygokings-art wants to merge 1 commit into
Open
Conversation
Implement touch event deduplication to prevent accidental double-submissions and unintended actions. Changes: - Add useTouchDeduplication hook for React components with configurable threshold (default 300ms) and coordinate tolerance (default 10px) - Add withTouchDeduplication wrapper for use outside React hooks - Add comprehensive test suite covering duplicate prevention, async handlers, and form submissions - Add detailed specification and implementation guide documentation Features: - Tracks last tap time and coordinates - Ignores duplicate taps within 300ms at same location - Prevents concurrent execution of async handlers - Optional onDuplicate callback for telemetry - Minimal memory and CPU overhead Fixes rinafcode#330
|
@daddygokings-art Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Kindly resolve conflict and fix workflow. |
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.
Closes #330
Description
Implements touch event deduplication to prevent accidental double-submissions and unintended actions caused by multiple touch events firing for a single tap.
Problem Statement
Solution
Provides two complementary APIs for touch event deduplication:
useTouchDeduplicationhook - For use within React componentswithTouchDeduplicationwrapper - For use outside React hooksBoth track last tap time and coordinates, ignoring subsequent taps within a configured threshold at the same location.
Changes
useTouchDeduplicationhook for React components with configurable threshold (default 300ms) and coordinate tolerance (default 10px)withTouchDeduplicationwrapper for use outside React hooksFeatures
onDuplicatecallback for telemetry or analyticsTesting
Acceptance Criteria
Files Changed
src/hooks/useTouchDeduplication.ts- Core implementationsrc/hooks/index.ts- Export hooktests/hooks/useTouchDeduplication.test.ts- Comprehensive test suitedocs/TOUCH_EVENT_DEDUPLICATION.md- Detailed specification and usage guide