Skip to content

Commit e56a07c

Browse files
Revert "Fix ResizeSensor/DomProps affecting component size diff"
This reverts commit 57e39e3. This didn't actually affect the size diff, since we compare the size of a single component, and not the size of the test case as a whole. As a result, all other code outside of the component is not factored into that size difference.
1 parent ed81cef commit e56a07c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

benchmark/dart2js_output/source.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ String componentBenchmark({
66
import 'package:over_react/over_react.dart';
77
part '{{PART_PATH}}';''');
88

9-
final mainStatements = StringBuffer();
9+
final mainStatements = StringBuffer()..writeln(mainAntiTreeShakingStatements);
1010
for (var i = 0; i < componentCount; i++) {
1111
final componentName = 'Foo$i';
1212
final mixinName = '${componentName}Props';
@@ -22,9 +22,7 @@ String componentBenchmark({
2222
}
2323
UiFactory<$propsName> $componentName = uiFunction((props) {
2424
${propReadStatements(propNames)}
25-
// Prevent tree-shaking of metadata and getPropKey generated impls
2625
final consumedProps = props.staticMeta.forMixins({$mixinName});
27-
props.getPropKey((p) => p.id);
2826
return (Dom.div()
2927
..addUnconsumedProps(props, consumedProps)
3028
..modifyProps(props.addPropsToForward())
@@ -45,6 +43,12 @@ String componentBenchmark({
4543
return fileSource.toString();
4644
}
4745

46+
const mainAntiTreeShakingStatements = '''
47+
(Dom.div()..id = '1')(); // Other props class, DomProps
48+
ResizeSensor()(); // class component, legacy component, PropsMeta used in propTypes
49+
ResizeSensor().getPropKey((p) => p.id); // getPropKey generated impls
50+
''';
51+
4852
String propDeclarations(Map propTypesByName) {
4953
return propTypesByName
5054
.mapEntries((name, type) => 'late $type $name;')

0 commit comments

Comments
 (0)