Skip to content

Always callback setSelected. #195

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

Merged
merged 3 commits into from
Sep 3, 2017

Conversation

exabugs
Copy link
Contributor

@exabugs exabugs commented Aug 10, 2017

I think this check is not necessary.

    if (index === this.props.selectedIndex) return;

Because we can't handle re-selected event.

If you want to do nothing when same tab is selected, you can check it at user-side.

    onSelect(index, lastIndex, event) {
        if (index === lastIndex) return;

@danez
Copy link
Collaborator

danez commented Aug 12, 2017

I see, that makes sense. I will test it.

This is a breaking change though.

@SaifAsad
Copy link

Hi @danez, any updates on the status of this pull request ? really need this feature to be implemented, can you please approve it ?

I am trying to implement closing tab functionality in my project and this check if (index === this.props.selectedIndex) return; is breaking my code,

Many thanks!!

@danez
Copy link
Collaborator

danez commented Sep 3, 2017

Thank you very much

@danez danez merged commit 3e5127b into reactjs:master Sep 3, 2017
danez pushed a commit that referenced this pull request Sep 5, 2017
BREAKING CHANGE: The `onSelect` callback will now also be called when clicking on the currently active tab.

* Always callback setSelected.

* Always callback setSelected. (npm run bundle)

* Add test
danez pushed a commit that referenced this pull request Sep 5, 2017
BREAKING CHANGE: The `onSelect` callback will now also be called when clicking on the currently active tab.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants