[PR #118] [MERGED] More efficient useKeyboard #301

Closed
opened 2026-03-02 23:45:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/118
Author: @remorses
Created: 8/31/2025
Status: Merged
Merged: 8/31/2025
Merged by: @msmps

Base: mainHead: use-keyboard-event


📝 Commits (2)

  • 0281145 do not bind handlers on every render
  • 22a99ec copilot is annoying

📊 Changes

2 files changed (+27 additions, -3 deletions)

View changed files

packages/react/src/hooks/use-event.tsx (+22 -0)
📝 packages/react/src/hooks/use-keyboard.tsx (+5 -3)

📄 Description

I added useEvent which let you create a stable function that always uses the latest version

This way there is no need to pass handler to the useEffect dependencies (which would usually be different on every render)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/118 **Author:** [@remorses](https://github.com/remorses) **Created:** 8/31/2025 **Status:** ✅ Merged **Merged:** 8/31/2025 **Merged by:** [@msmps](https://github.com/msmps) **Base:** `main` ← **Head:** `use-keyboard-event` --- ### 📝 Commits (2) - [`0281145`](https://github.com/anomalyco/opentui/commit/02811457af5068d5e794ada3d0a915160e22027d) do not bind handlers on every render - [`22a99ec`](https://github.com/anomalyco/opentui/commit/22a99eca8357883212e1e0e18e1c0189f1a32f81) copilot is annoying ### 📊 Changes **2 files changed** (+27 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `packages/react/src/hooks/use-event.tsx` (+22 -0) 📝 `packages/react/src/hooks/use-keyboard.tsx` (+5 -3) </details> ### 📄 Description I added useEvent which let you create a stable function that always uses the latest version This way there is no need to pass handler to the useEffect dependencies (which would usually be different on every render) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:45:52 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#301
No description provided.