Skip to content

docs: refactor AutoCompleteInput example to remove unnecessary useRef#327

Merged
kimyouknow merged 1 commit into
toss:mainfrom
mlnwns:docs/refactor-autocomplete
Feb 24, 2026
Merged

docs: refactor AutoCompleteInput example to remove unnecessary useRef#327
kimyouknow merged 1 commit into
toss:mainfrom
mlnwns:docs/refactor-autocomplete

Conversation

@mlnwns
Copy link
Copy Markdown
Contributor

@mlnwns mlnwns commented Feb 22, 2026

Overview

This PR introduces an improvement to the AutoCompleteInput example in the documentation (without-react-simplikit.tsx).

The debouncing logic has been refactored to remove the unnecessary useRef (searchTimeoutRef) and the redundant clearTimeout defensive code. By assigning the timer to a local timeoutId variable and leveraging closures for the cleanup function, the code becomes much more declarative and concise.

Additionally, this change cleanly resolves the NodeJS.Timeout type dependency issue between browser and Node environments, enhancing type safety and the developer experience without changing the component's external behavior.

Checklist

  • Did you write the test code?
  • Have you run yarn run fix to format and lint the code and docs?
  • Have you run yarn run test:coverage to make sure there is no uncovered line?
  • Did you write the JSDoc?

Copilot AI review requested due to automatic review settings February 22, 2026 08:00
Copy link
Copy Markdown

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 refactors the AutoCompleteInput example in the documentation to demonstrate a cleaner approach to debouncing. The changes remove the unnecessary useRef hook and defensive clearTimeout checks by leveraging closures and React's built-in cleanup mechanism.

Changes:

  • Removed searchTimeoutRef useRef hook from the "without-react-simplikit" example
  • Refactored debouncing logic to use a local timeoutId variable with closure-based cleanup
  • Simplified cleanup function from a defensive null-check pattern to a single line

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/core/why-react-simplikit-matters.md Updated English documentation example to demonstrate cleaner timeout cleanup pattern
docs/ko/core/why-react-simplikit-matters.md Updated Korean documentation example with identical refactoring as English version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@kimyouknow kimyouknow left a comment

Choose a reason for hiding this comment

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

thanks!

@kimyouknow kimyouknow merged commit 2b5f92c into toss:main Feb 24, 2026
13 of 14 checks passed
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.

3 participants