Skip to content

Refactor useSwipe to separate event handlers from state#19

Draft
Copilot wants to merge 3 commits intofeat/personal-sitefrom
copilot/sub-pr-13-one-more-time
Draft

Refactor useSwipe to separate event handlers from state#19
Copilot wants to merge 3 commits intofeat/personal-sitefrom
copilot/sub-pr-13-one-more-time

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

Spreading the full useSwipe() return object onto DOM elements passes non-standard props (state values and helper functions), which should only receive standard HTML attributes and event handlers.

Changes:

  • Modified useSwipe hook to return event handlers in a separate handlers object
  • Updated PinnedAppCard and AppGridCard to explicitly spread only touch/click handlers
  • Merged with main branch, preserving the handler separation fix while integrating the auto-close timer feature

Before:

const swipeProps = useSwipe({ ... });
<div {...swipeProps} /> // Spreads state values onto DOM

After:

const swipeProps = useSwipe({ ... });
<div 
  onTouchStart={swipeProps.handlers.onTouchStart}
  onTouchMove={swipeProps.handlers.onTouchMove}
  onTouchEnd={swipeProps.handlers.onTouchEnd}
  onClick={handleClick}
/>
// State values accessed directly: swipeProps.isSwipeMenuOpen

Note: This PR has been rebased onto main after the base branch feat/personal-site was merged. The fix remains necessary as the main branch still spreads all properties directly onto DOM elements.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI mentioned this pull request Feb 12, 2026
@vercel
Copy link

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
string-v2 Ready Ready Preview, Comment Feb 16, 2026 10:29am

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback from review on personal site feature implementation Refactor useSwipe to separate event handlers from state Feb 12, 2026
Copilot AI requested a review from ghostleek February 12, 2026 16:11
@ghostleek
Copy link
Contributor

@copilot can you resolve the merge conflicts and confirm if this is still necessary?

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot can you resolve the merge conflicts and confirm if this is still necessary?

Resolved merge conflicts in commit f514681. This PR is still necessary - the main branch currently spreads all useSwipe return values (including state like isSwipeMenuOpen and functions like closeSwipeMenu) directly onto DOM elements.

This PR maintains the fix that separates event handlers into a handlers object, so only appropriate event handlers are passed to DOM elements. The merge also preserves the new auto-close timer feature from main.

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.

2 participants