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

Reset selected item only when list values change #33

Merged
merged 6 commits into from
Oct 4, 2020

Conversation

lujiajing1126
Copy link
Contributor

Fix issue #22

.gitignore Outdated
@@ -1,3 +1,4 @@
build
node_modules
yarn.lock
.vscode
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be in your own global gitignore, not here. https://gist.github.com/subfuzion/db7f57fff2fb6998a16c

Copy link
Contributor Author

@lujiajing1126 lujiajing1126 Oct 3, 2020

Choose a reason for hiding this comment

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

Thanks for mentioning this! Fixed

package.json Outdated
"name": "Megrez Lu",
"email": "[email protected]"
}
],
Copy link
Collaborator

Choose a reason for hiding this comment

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

The contributors field is not used by npm or any tool and it's a chore to maintain. Your contribution will be reflected in the commit history and https://github.com/vadimdemedes/ink-select-input/graphs/contributors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Removed

@@ -82,7 +83,7 @@ function SelectInput<V>({
const previousItems = useRef<Array<Item<V>>>(items);

useEffect(() => {
if (!isEqual(previousItems.current, items)) {
if (!isEqual(_map(previousItems.current, 'value'), _map(items, 'value'))) {
Copy link
Owner

Choose a reason for hiding this comment

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

Could you use native .map() function over the one in lodash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed. But there seems to be a style issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed with prettier

package.json Outdated
@@ -7,7 +7,7 @@
"author": {
"name": "Vadim Demedes",
"email": "[email protected]",
"url": "github.com/vadimdemedes"
"url": "https://github.com/vadimdemedes"
Copy link
Owner

Choose a reason for hiding this comment

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

Unrelated change, could you revert it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted

.gitignore Outdated
@@ -1,3 +1,3 @@
build
node_modules
yarn.lock
yarn.lock
Copy link
Owner

Choose a reason for hiding this comment

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

Unrelated change, could you revert it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted

@vadimdemedes
Copy link
Owner

vadimdemedes commented Oct 3, 2020

Minor feedback, but looks good overall, thanks!

@vadimdemedes
Copy link
Owner

Thanks!

@vadimdemedes vadimdemedes changed the title Only compare values of items Reset selected item only when list values change Oct 4, 2020
@vadimdemedes vadimdemedes merged commit a9a2c75 into vadimdemedes:master Oct 4, 2020
@vadimdemedes
Copy link
Owner

vadimdemedes commented Oct 4, 2020

Released in 4.2.0.

dnnsmnstrr added a commit to dnnsmnstrr/ink-select-input that referenced this pull request Mar 4, 2023
* upstream/master:
  5.0.0
  Migrate to ESM and Ink 4 (vadimdemedes#46)
  4.2.2
  Refresh dependencies
  Fix stuck selection when `initialIndex` is larger than `limit` (vadimdemedes#44)
  4.2.1
  Update peer dependencies to allow React 17.x (vadimdemedes#37)
  Fix old version link in readme
  4.2.0
  Reset selected item only when list values change (vadimdemedes#33)
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