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
FranckyC opened this Issue Nov 30, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@FranckyC
Copy link

FranckyC commented Nov 30, 2018

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 estruyf added the enhancement label Dec 6, 2018

@estruyf

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link

FranckyC commented Dec 6, 2018

Thanks @estruyf! I'll test this ASAP.

@FranckyC

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Collaborator

estruyf commented Dec 6, 2018

My mistake will update it right away.

estruyf added a commit that referenced this issue Dec 6, 2018

@estruyf

This comment has been minimized.

Copy link
Collaborator

estruyf commented Dec 6, 2018

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

@FranckyC

This comment has been minimized.

Copy link

FranckyC commented Dec 6, 2018

Works like a charm! Thanks @estruyf
untitled project

@estruyf estruyf closed this Dec 13, 2018

@DanSantoDomingo

This comment has been minimized.

Copy link

DanSantoDomingo commented Jan 17, 2019

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