From b0dd0366b4bbfabf58e0d7e29a67af1b794b1211 Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Fri, 8 Nov 2019 16:40:17 -0700 Subject: [PATCH 1/3] Restore accidentally removed export --- lib/over_react.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/over_react.dart b/lib/over_react.dart index 05dada8cd..578e7562e 100644 --- a/lib/over_react.dart +++ b/lib/over_react.dart @@ -70,6 +70,7 @@ export 'src/util/key_constants.dart'; export 'src/util/map_util.dart'; export 'src/util/pretty_print.dart'; export 'src/util/prop_errors.dart'; +export 'src/util/prop_key_util.dart'; export 'src/util/react_util.dart'; export 'src/util/react_wrappers.dart'; export 'src/util/rem_util.dart'; From ed04a7cca51579cec674a2e9504ed1f5da8288a9 Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Fri, 8 Nov 2019 16:41:31 -0700 Subject: [PATCH 2/3] over_react 3.1.2 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f5e701de..4550055c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # OverReact Changelog +## [3.1.2](https://github.com/Workiva/over_react/compare/3.1.1...3.1.2) + +- Restore the public `getPropKey` function that was accidentally made private in the 3.1.0 release. + ## [3.1.1](https://github.com/Workiva/over_react/compare/3.1.0...3.1.1) - Restore the `xmlLang`, `xmlSpace`, `y1`, `y2`, `y` members that were accidentally removed from `SvgProps` in the 3.1.0 release. diff --git a/pubspec.yaml b/pubspec.yaml index fb7b743da..64c8b7e54 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: over_react -version: 3.1.1 +version: 3.1.2 description: A library for building statically-typed React UI components using Dart. homepage: https://github.com/Workiva/over_react/ authors: From 3016a78bcf2be92b7fe21723a024221d35837da5 Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Fri, 8 Nov 2019 17:00:48 -0700 Subject: [PATCH 3/3] Deprecate UiComponent.getPropKey, replace with keyForProp --- lib/src/component_declaration/component_base_2.dart | 9 ++++++++- .../constant_required_accessor_integration_test.dart | 2 +- .../component2/required_accessor_integration_test.dart | 2 +- web/component2/src/demo_components/prop_validation.dart | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/src/component_declaration/component_base_2.dart b/lib/src/component_declaration/component_base_2.dart index 185ecd1e7..71c298a06 100644 --- a/lib/src/component_declaration/component_base_2.dart +++ b/lib/src/component_declaration/component_base_2.dart @@ -253,6 +253,13 @@ abstract class UiComponent2 extends react.Component2 @override Map> get propTypes => {}; + /// Returns the string key of the [factory] prop accessed in [accessProp], including the namespace if one exists. + /// + /// __DEPRECATED__: This method had to be deprecated and replaced with [keyForProp] because of the way + /// that shadowing works in Dart when a top-level function name matches the name of an instance method. + @Deprecated('4.0.0') + String getPropKey(void Function(TProps props) accessProp) => keyForProp(accessProp); + /// Returns the string key of the [factory] prop accessed in [accessProp], including the namespace if one exists. /// /// Intended for use within [propTypes]. @@ -277,7 +284,7 @@ abstract class UiComponent2 extends react.Component2 /// } /// } /// ``` - String getPropKey(void Function(TProps props) accessProp) => prop_key_util.getPropKey(accessProp, typedPropsFactory); + String keyForProp(void Function(TProps props) accessProp) => prop_key_util.getPropKey(accessProp, typedPropsFactory); // *************************************************************************** // diff --git a/test/over_react/component_declaration/builder_integration_tests/component2/constant_required_accessor_integration_test.dart b/test/over_react/component_declaration/builder_integration_tests/component2/constant_required_accessor_integration_test.dart index 41eb6c545..6d83cb435 100644 --- a/test/over_react/component_declaration/builder_integration_tests/component2/constant_required_accessor_integration_test.dart +++ b/test/over_react/component_declaration/builder_integration_tests/component2/constant_required_accessor_integration_test.dart @@ -252,7 +252,7 @@ class _$ComponentTestProps extends UiProps { class ComponentTestComponent extends UiComponent2 { @override get propTypes => { - getPropKey((p) => p.requiredAndLengthLimited): (props, info) { + this.getPropKey((p) => p.requiredAndLengthLimited): (props, info) { final length = props.requiredAndLengthLimited?.length; if (length != 2) { return PropError.value(length, info.propName, 'must have a length of 2'); diff --git a/test/over_react/component_declaration/builder_integration_tests/component2/required_accessor_integration_test.dart b/test/over_react/component_declaration/builder_integration_tests/component2/required_accessor_integration_test.dart index ca1cb6ead..5bc54a376 100644 --- a/test/over_react/component_declaration/builder_integration_tests/component2/required_accessor_integration_test.dart +++ b/test/over_react/component_declaration/builder_integration_tests/component2/required_accessor_integration_test.dart @@ -256,7 +256,7 @@ class _$ComponentTestProps extends UiProps { class ComponentTestComponent extends UiComponent2 { @override get propTypes => { - getPropKey((p) => p.requiredAndLengthLimited): (props, info) { + keyForProp((p) => p.requiredAndLengthLimited): (props, info) { final length = props.requiredAndLengthLimited?.length; if (length != 2) { return PropError.value(length, info.propName, 'must have a length of 2'); diff --git a/web/component2/src/demo_components/prop_validation.dart b/web/component2/src/demo_components/prop_validation.dart index b14768047..8e7c41f9c 100644 --- a/web/component2/src/demo_components/prop_validation.dart +++ b/web/component2/src/demo_components/prop_validation.dart @@ -33,7 +33,7 @@ class PropTypesTestComponent extends UiComponent2 { // This is closer to what it looks like in JS, but might be confusing syntax. @override get propTypes => { - getPropKey((p) => p.twoObjects): (props, info) { + keyForProp((p) => p.twoObjects): (props, info) { final length = props.twoObjects?.length; if (length != 2) { return PropError.value(length, info.propName, 'must have a length of 2');