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

PropertyFieldCodeEditor- Handle initial value update when new props #121

Closed
2 tasks
FranckyC opened this issue Nov 30, 2018 · 8 comments
Closed
2 tasks
Milestone

Comments

@FranckyC
Copy link
Member

In the PropertyFieldCodeEditor field, the initial value is only set at mount time and can't be updated afterwards. It could useful to handle the value update when receiving new props.

This scenario happens in the react-search-refiners sample when the user chooses a different layout resulting to initial value to be updated for the selected layout.

Category

  • [ X] Enhancement
  • Bug
  • Question

Version

Latest

@estruyf
Copy link
Member

estruyf commented Dec 6, 2018

Thanks @FranckyC, will be updated in v1.13.0.

estruyf added a commit that referenced this issue Dec 6, 2018
@estruyf
Copy link
Member

estruyf commented Dec 6, 2018

A fix has just been added for this issue. Feel free to test out the latest beta to check if it is fixed for your solution. More information about installing a beta version can be found here: https://sharepoint.github.io/sp-dev-fx-property-controls/beta/

@estruyf estruyf added this to the 1.13.0 milestone Dec 6, 2018
@FranckyC
Copy link
Member Author

FranckyC commented Dec 6, 2018

Thanks @estruyf! I'll test this ASAP.

@FranckyC
Copy link
Member Author

FranckyC commented Dec 6, 2018

@estruyf Unfortunately, it doesn't work. After reviewing your commit it seems you take props instead of nextProps when setting the new code value. Should it be nextProps instead?

this.setState({
        code: typeof this.props.initialValue !== 'undefined' ? this.props.initialValue : ''
      });

@estruyf
Copy link
Member

estruyf commented Dec 6, 2018

My mistake will update it right away.

estruyf added a commit that referenced this issue Dec 6, 2018
@estruyf
Copy link
Member

estruyf commented Dec 6, 2018

Fix is in, and the beta release should be out in any minute now.

@FranckyC
Copy link
Member Author

FranckyC commented Dec 6, 2018

Works like a charm! Thanks @estruyf
untitled project

@DanSantoDomingo
Copy link

Hello im new to sharepoint framework and react.. what i want to do is set the webpart code as the initial value.. i tried putting this.domElement but wont work.. also what should i put inside the onPropertyChange to save the changes?

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

3 participants