Back out "[Flipper] Use the tree node idenitifer as the component identifier"

Summary:
Original commit changeset: 4d83c1bee3fd

BUG:

{F159187385}

Reviewed By: passy

Differential Revision: D15415247

fbshipit-source-id: 6209a2c9c2b5da6b9405bf01e3cb7622b3431475
This commit is contained in:
Pritesh Nandgaonkar
2019-05-20 09:43:51 -07:00
committed by Facebook Github Bot
parent 7f99a5cfe2
commit 0a514c3618

View File

@@ -57,6 +57,7 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
SKComponentLayoutWrapper *const wrapper =
[[SKComponentLayoutWrapper alloc] initWithLayout:layout
position:CGPointMake(0, 0)
parentKey:[NSString stringWithFormat: @"%p.", layout.component]
reuseWrapper:reuseWrapper];
// Cache the result.
if (layout.component) {
@@ -67,13 +68,14 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
- (instancetype)initWithLayout:(const CKComponentLayout &)layout
position:(CGPoint)position
parentKey:(NSString *)parentKey
reuseWrapper:(CKComponentReuseWrapper *)reuseWrapper
{
if (self = [super init]) {
_component = layout.component;
_size = layout.size;
_position = position;
_identifier = _component ? [NSString stringWithFormat:@"%d", _component.treeNode.nodeIdentifier] : @"(null)";
_identifier = [parentKey stringByAppendingString:layout.component ? NSStringFromClass([layout.component class]) : @"(null)"];
if (_component && reuseWrapper) {
auto const canBeReusedCounter = [reuseWrapper canBeReusedCounter:_component.treeNode.nodeIdentifier];
@@ -83,12 +85,14 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
}
if (layout.children != nullptr) {
int index = 0;
for (const auto &child : *layout.children) {
if (child.layout.component == nil) {
continue; // nil children are allowed, ignore them
}
SKComponentLayoutWrapper *childWrapper = [[SKComponentLayoutWrapper alloc] initWithLayout:child.layout
position:child.position
parentKey:[_identifier stringByAppendingFormat:@"[%d].", index++]
reuseWrapper:reuseWrapper];
childWrapper->_isFlexboxChild = [_component isKindOfClass:[CKFlexboxComponent class]];
childWrapper->_flexboxChild = findFlexboxLayoutParams(_component, child.layout.component);