Skip to content
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

fix: remove redundant memoization from parameter render components to fix input cursor position #5347

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

Cristhianzl
Copy link
Member

This pull request addresses the cursor position jumping issue in form inputs by removing unnecessary memoization from the ParameterRenderComponent. By simplifying the component's render cycle, we ensure proper cursor position maintenance during typing.

Changes:

  • Removed redundant memo HOC wrappers from child components
  • Simplified unnecessary useMemo and useCallback hooks on non-expensive computations
  • Inlined the ParameterRenderProps interface for better code colocation
  • Streamlined prop passing and component rendering logic

Technical Details:

  • Removed memoization from component imports to allow proper re-renders
  • Simplified ID and baseInputProps generation by removing useMemo
  • Replaced useCallback with direct function definition for renderComponent
  • Components now maintain cursor position during typing by allowing natural re-renders

Testing:

  • Verified cursor position stays in place when typing in the middle of text
  • Confirmed all input components maintain proper functionality
  • Ensured performance is not negatively impacted by memoization removal

…nent to improve code readability and maintainability. Remove unnecessary memoization and useCallback hooks, simplify component rendering logic, and optimize component structure.
@Cristhianzl Cristhianzl self-assigned this Dec 18, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Dec 18, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 18, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 18, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 19, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 19, 2024
Copy link
Collaborator

@lucaseduoli lucaseduoli left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 19, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 19, 2024
@Cristhianzl Cristhianzl added this pull request to the merge queue Dec 19, 2024
Merged via the queue into main with commit fa46786 Dec 19, 2024
22 checks passed
@Cristhianzl Cristhianzl deleted the cz/rollback-memo-field branch December 19, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants