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

Issue hydrating new selectFrom/selectTo values externally #1

Open
AlanFoster opened this issue May 8, 2017 · 1 comment
Open

Issue hydrating new selectFrom/selectTo values externally #1

AlanFoster opened this issue May 8, 2017 · 1 comment

Comments

@AlanFoster
Copy link

AlanFoster commented May 8, 2017

Hey; Thanks for the component.

I just noticed that if you're using a flux/redux style of state management to persist and hydrate the selectFrom/selectTo values - there are infinite onSelectionChange all backs triggered.

I believe the problem is due to componentWillReceiveProps implementation:

componentWillReceiveProps(nextProps){
    if(nextProps.selectFrom && nextProps.selectTo){
        this.selectFrom = nextProps.selectedFrom;
        this.selectTo = nextProps.selectTo;
        this.changeSelection(nextProps.selectFrom);
    }
}

Which then calls changeSelection, which triggers an additional callback:

this.props.onSelectionChange(value, this.prevValue, selectedRange);

Unfortunately this infinite cycle leads to the stack exploding.

Perhaps the new implementation would allow for hydration of new selectFrom/selectTo values - without receiving the the onSelectionChange callback?

@melihmucuk
Copy link
Owner

I tested with mobx, it works as expected. I didn't try with redux.

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

No branches or pull requests

2 participants