Skip to content

fix(button): Prevent duplicate click events across frameworks while preserving native behaviour #4359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 27, 2025

Conversation

michaelmkraus
Copy link
Contributor

@michaelmkraus michaelmkraus commented Jun 11, 2025

Proposed changes

  • Prevent duplicate click events across frameworks while preserving native behaviour

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (fix on existing components or architectural decisions)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

closes #4339

Copy link
Contributor

@michaelmkraus michaelmkraus changed the title fix(button): prevent duplicate click events by stopping propagation fix(button): Prevent duplicate click events across frameworks while preserving native behaviour Jun 12, 2025
@mfranzke mfranzke requested a review from Copilot June 16, 2025 05:07
Copilot

This comment was marked as outdated.

@nmerget nmerget enabled auto-merge (squash) June 26, 2025 11:47
nmerget
nmerget previously approved these changes Jun 26, 2025
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mfranzke mfranzke requested a review from Copilot June 26, 2025 13:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR centralizes click event handling by removing per-component click logic and introducing a Mitosis plugin to apply it across framework targets.

  • Strip out local useStore click handler and inline onClick bindings from DBLink and DBButton
  • Add a shared on-click plugin to Vue, React, Angular, and Stencil configs
  • Consolidate TypeScript option under commonOptions in mitosis.config.cjs

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/components/src/components/link/link.lite.tsx Removed local click state and inline onClick binding
packages/components/src/components/button/button.lite.tsx Removed local click state and inline onClick binding
packages/components/configs/vue/index.cjs Added onClickPlugin to Vue Mitosis config
packages/components/configs/stencil/index.cjs Added onClickPlugin to Stencil Mitosis config
packages/components/configs/react/index.cjs Added onClickPlugin to React Mitosis config
packages/components/configs/angular/index.cjs Added onClickPlugin to Angular Mitosis config
packages/components/configs/mitosis.config.cjs Introduced commonOptions.typescript for all targets
Comments suppressed due to low confidence (1)

packages/components/src/components/link/link.lite.tsx:7

  • The useStore import is no longer used after removing the click handler logic; consider removing it.
} from '@builder.io/mitosis';

nmerget and others added 4 commits June 26, 2025 16:46
@nmerget nmerget merged commit e4f0c3b into main Jun 27, 2025
75 checks passed
@nmerget nmerget deleted the fix-button-click-double-call branch June 27, 2025 07:04
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in UX Engineering Team Backlog Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Regression: Buttons fire twice in Angular
3 participants