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

Fix for #46 Doesn't listen property changes for option parameter #47

Merged
merged 3 commits into from
Aug 23, 2016

Conversation

acierto
Copy link
Contributor

@acierto acierto commented Aug 22, 2016

No description provided.

@@ -69,6 +69,10 @@ export default class Select2 extends Component {
this.initSelect2(false);
}

if (!shallowEqualFuzzy(prevProps.options, this.props.options)) {
this.el.select2(this.props.options);
Copy link
Owner

@rkit rkit Aug 23, 2016

Choose a reason for hiding this comment

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

When updating options you should consider following:
L95-97

const { options } = this.props;
if (!shallowEqualFuzzy(prevProps.options, options)) {
if (typeof options.dropdownParent === 'string') {
options.dropdownParent = $(options.dropdownParent);
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe make a separate method prepareOptions?
To avoid duplicate code:

if (typeof options.dropdownParent === 'string') {
  options.dropdownParent = $(options.dropdownParent);

@rkit rkit merged commit c0ecbf5 into rkit:master Aug 23, 2016
@rkit
Copy link
Owner

rkit commented Aug 23, 2016

Thanks. Tomorrow will be release.

@acierto
Copy link
Contributor Author

acierto commented Aug 23, 2016

Great!

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