I have a question about the behavior of defaultSelectedKey and selectedKey on the Dropdown component. Currently defaultSelectedKey overrides selectedKey when the component renders for the first time. As I understand usually when a value is null/undefined we can specify some other value as the default, but this behavior contradicts this logic. Is this correct?
You want to use selectedKey if it's a controlled component, and typically defaultSelectedKey if it's an uncontrolled component. The behavior should be similar to
https://facebook.github.io/react/docs/forms.html and https://facebook.github.io/react/docs/uncontrolled-components.html#default-values
@cschleiden One thing we should consider is to refine how deprecation warnings occur. Right now BaseComponent takes in a deprecation map. However I think this is the wrong design. Instead I was thinking we'd have a deprecation.ts file that exposes helpers for generating warnings.
This file could export a variety of helpers to deprecate specific scenarios:
warnDeprecatedMap(props, { map });
warnDeprecatedEnum(props.enum, [ Enum.val1, Enum.val2 ]);
warnMutuallyExclusive(props, 'selectedKey', 'defaultSelectedKey');
In this particular case we should warn that these two things are mutually exclusive.
@dzearing that makes sense, and maybe only do it in non-production mode.
@cschleiden Made a PR for it. however, it's more of a webpack configuration deal to strip in production mode. I think we should, but not sure the best way.
Great. On vacation right now, if still open on Monday I'll take a look :)
For conditional compilation I've used https://github.com/nippur72/ifdef-loader/blob/master/README.md for another project, but not sure if stable enough for office fabric.
On Apr 1, 2017 15:57, David Zearing notifications@github.com wrote:
@cschleidenhttps://github.com/cschleiden Made a PR for it. however, it's more of a webpack configuration deal to strip in production mode. I think we should, but not sure the best way.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-ui-fabric-react/issues/1369#issuecomment-290952619, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACGY20SOwpZHsLxvSUvHw1V6amOx6XPLks5rrtZKgaJpZM4MssoV.