Skip to content

feat(useInputState): support lazy initialization for initial value - #469

Merged
hyesungoh merged 4 commits into
toss:mainfrom
DongEun02:feat/add-lazy-initializer
Sep 6, 2026
Merged

feat(useInputState): support lazy initialization for initial value#469
hyesungoh merged 4 commits into
toss:mainfrom
DongEun02:feat/add-lazy-initializer

Conversation

@DongEun02

Copy link
Copy Markdown
Contributor

Overview

useInputState is a custom hook built on top of React's useState. However, because the initialValue type was limited to string, it did not support the lazy initializer provided by useState.

This PR expands the initialValue type to accept string | (() => string), allowing the initial value to be computed lazily and avoiding unnecessary recalculation on re-renders.

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?

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17b59aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-simplikit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov-commenter

codecov-commenter commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (92cbb34) to head (17b59aa).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #469   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           67        67           
  Lines         2204      2204           
  Branches       711       711           
=========================================
  Hits          2204      2204           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hyesungoh hyesungoh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your contribution! 👍

transformValue: (value: string) => string = (v: string) => v

can you update this korean docs too? 🙏

@DongEun02

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out! I've updated the Korean docs.

@hyesungoh hyesungoh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution! 👍

@hyesungoh
hyesungoh merged commit cc8b69e into toss:main Sep 6, 2026
19 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