pnp / sp-dev-fx-property-controls

Reusable SPFx property pane controls - Open source initiative
https://pnp.github.io/sp-dev-fx-property-controls/
MIT License
235 stars 150 forks source link

PropertyFieldChoiceGroupWithCallout deletes properties #592

Closed IRRDC closed 10 months ago

IRRDC commented 10 months ago

Category

Version

Please specify what version of the library you are using: [3.15.0]

Expected / Desired Behavior / Question

In the newest version the property assigned to the PropertyFieldChoiceGroupWithCallout gets deleted when a selection gets checked.

Observed Behavior

The current value does not get selected on load (anymore). It does show up when looking at it using the PropertyPanePropertyEditor. As soon as one of the options gets checked the whole property vanishes from the PropertyPanePropertyEditor.

Steps to Reproduce

I created a fresh SPFX webpart using yo and just added the sample codes from https://pnp.github.io/sp-dev-fx-property-controls/controls/PropertyPanePropertyEditor/ and https://pnp.github.io/sp-dev-fx-property-controls/controls/PropertyFieldChoiceGroupWithCallout/ I also added "choiceGroupWithCalloutValue": "Android" to the manifest.json to create a default value.

Sample code: s1

No choice selected on load: s2

Property exists before making a choice: s2a

Property is gone after making a choice: s3

ghost commented 10 months ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

IRRDC commented 10 months ago

Also happens in the PropertyControlsTestWebPart from this repository.

IRRDC commented 10 months ago

One of the reasons for the bug is this change: https://github.com/pnp/sp-dev-fx-property-controls/commit/46edef633bf6f5c628b96c1c3d44933c85be6987#diff-162be79c6bc5b46836132ba0090fc8c213f7d20933388840100ba07b547164d9 where _onChanged gets assigend to onChange which comes with 2 parameters instead of one, so changing the signature of _onChanged to include the parameter will store the result again. Strangely that doesn't fix the problem of displaying the selected choice on re-rendering yet.

    private _onChanged(ev?: React.FormEvent<HTMLElement | HTMLInputElement>, option?: IChoiceGroupOption): void {
        if (this._onChangeCallback) {
            this._onChangeCallback(this.targetProperty, option.key);
        }
    }
IRRDC commented 10 months ago

Does an error of this severity warrant a 3.15.1 release since it renders the PropertyFieldChoiceGroupWithCallout control unusable and may destroy existing web part configurations?

joelfmrodrigues commented 10 months ago

@IRRDC many thanks for all the info, we are discussing it and will try to resolve it as soon as we have the chance. In the meantime, I suggest you keep using the previous version if possible.

spplante commented 10 months ago

Noticed the same issue today, rolling back in version fixed it for now

AJIXuMuK commented 10 months ago

Thanks for reporting the issue. It has been fixed and version 3.15.1 has been release.