[PR #4379] refactor: refactor the button component using forwardRef #24507

Closed
opened 2026-02-21 20:23:08 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/4379

State: closed
Merged: Yes


Description

refactor the button component using forwardRef

The previous button component was disguised as a div, which would lose the original capabilities of HTML, such as form submission. This will prevent users from submitting when JavaScript capabilities are turned off. But when we follow web standards, we can bring a better experience

This submission includes three contents:

  1. Use forwardRef to reconstruct the button component
  2. Change the original type attribute to variant. Type is the original attribute of button. We should not modify it.
  3. Removed memo. As a basic component, memo is not required
    Fixes # (issue)

Type of Change

Please delete options that are not relevant.

  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement

How Has This Been Tested?

All button components should behave the same as before

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/4379 **State:** closed **Merged:** Yes --- # Description refactor the button component using `forwardRef` The previous button component was disguised as a div, which would lose the original capabilities of HTML, such as form submission. This will prevent users from submitting when JavaScript capabilities are turned off. But when we follow web standards, we can bring a better experience This submission includes three contents: 1. Use forwardRef to reconstruct the button component 2. Change the original `type` attribute to `variant`. Type is the original attribute of button. We should not modify it. 3. Removed `memo`. As a basic component, memo is not required Fixes # (issue) ## Type of Change Please delete options that are not relevant. - [x] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement # How Has This Been Tested? All button components should behave the same as before # Suggested Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] My changes generate no new warnings - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:23:08 -05:00
yindo closed this issue 2026-02-21 20:23:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#24507