Skip to content

feat(core/hooks): add 'useList' hook#341

Merged
kimyouknow merged 3 commits intotoss:mainfrom
sukvvon:feat/use-list
Mar 17, 2026
Merged

feat(core/hooks): add 'useList' hook#341
kimyouknow merged 3 commits intotoss:mainfrom
sukvvon:feat/use-list

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Mar 9, 2026

Overview

Add useList hook for managing array state with stable action functions.

Actions: push, insertAt, updateAt, removeAt, setAll, reset

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?

});

const setAll = usePreservedCallback((values: T[]) => {
setList(values);
Copy link
Collaborator

Choose a reason for hiding this comment

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

setAll passes the array reference directly (setList(values)) without copying, while useSet.setAll creates a new Set via new Set(values).

External mutations to the passed array could affect state. Non-blocking — just a consistency point.

Copy link
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.

Clean implementation! The action set (push/insertAt/updateAt/removeAt/setAll/reset) covers array operations well without over-abstracting.

@kimyouknow kimyouknow merged commit b40b0ce into toss:main Mar 17, 2026
10 checks passed
@sukvvon
Copy link
Contributor Author

sukvvon commented Mar 17, 2026

@kimyouknow Same issue as #342 — the merge commit (b40b0ce) has you as the Author instead of me. It looks like this was also merged with a regular merge commit instead of squash merge.

kimyouknow added a commit that referenced this pull request Mar 17, 2026
This reverts commit b40b0ce, reversing
changes made to ffc61bb.
kimyouknow pushed a commit that referenced this pull request Mar 17, 2026
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.

2 participants