batch fs properties into single native command#144
batch fs properties into single native command#144RyanCommits wants to merge 1 commit intomasterfrom
Conversation
martin-fs
left a comment
There was a problem hiding this comment.
LGTM but please add another check for robustness.
| } | ||
| if (props[@"dataComponent"]) { | ||
| set_dataComponent(props[@"dataComponent"], self); | ||
| } |
There was a problem hiding this comment.
Should we add a warning for any unrecognized props? Previously we always had a fallthrough. I assume if the commandName is setBatchProperties we don't want to fallthrough.
Easiest way to do this: count the handled props and compare that count to the total count in the dictionary.
There was a problem hiding this comment.
Creating a warning probably isn't worth it. We control the command call, so extra props wouldn't be expected. For the count to work, we'd have to get 7 prop types and above. Normally components wouldn't have all 6 fullstory attributes anyway, so we'd miss the warning if there was 1 or 2 extra props with 4 or less fullstory attributes.
4d522ec to
2db5247
Compare
| if ([commandName isEqualToString:@"setBatchProperties"]) { | ||
| // Batched properties command - applies all properties in a single call | ||
| // to reduce race conditions with React Native's rendering scheduler | ||
| NSDictionary *props = args[0]; | ||
| if (props[@"fsAttribute"]) { | ||
| set_fsAttribute(props[@"fsAttribute"], self); | ||
| } | ||
| if (props[@"fsClass"]) { | ||
| set_fsClass(props[@"fsClass"], self); | ||
| } | ||
| if (props[@"fsTagName"]) { | ||
| set_fsTagName(props[@"fsTagName"], self); | ||
| } | ||
| if (props[@"dataElement"]) { | ||
| set_dataElement(props[@"dataElement"], self); | ||
| } | ||
| if (props[@"dataSourceFile"]) { | ||
| set_dataSourceFile(props[@"dataSourceFile"], self); | ||
| } | ||
| if (props[@"dataComponent"]) { | ||
| set_dataComponent(props[@"dataComponent"], self); | ||
| } |
There was a problem hiding this comment.
| if ([commandName isEqualToString:@"setBatchProperties"]) { | |
| // Batched properties command - applies all properties in a single call | |
| // to reduce race conditions with React Native's rendering scheduler | |
| NSDictionary *props = args[0]; | |
| if (props[@"fsAttribute"]) { | |
| set_fsAttribute(props[@"fsAttribute"], self); | |
| } | |
| if (props[@"fsClass"]) { | |
| set_fsClass(props[@"fsClass"], self); | |
| } | |
| if (props[@"fsTagName"]) { | |
| set_fsTagName(props[@"fsTagName"], self); | |
| } | |
| if (props[@"dataElement"]) { | |
| set_dataElement(props[@"dataElement"], self); | |
| } | |
| if (props[@"dataSourceFile"]) { | |
| set_dataSourceFile(props[@"dataSourceFile"], self); | |
| } | |
| if (props[@"dataComponent"]) { | |
| set_dataComponent(props[@"dataComponent"], self); | |
| } | |
| if ([commandName isEqualToString:@"setBatchProperties"]) { | |
| NSUInteger commandCount = 0; | |
| // Batched properties command - applies all properties in a single call | |
| // to reduce race conditions with React Native's rendering scheduler | |
| NSDictionary *props = args[0]; | |
| if (props[@"fsAttribute"]) { | |
| set_fsAttribute(props[@"fsAttribute"], self); | |
| commandCount++; | |
| } | |
| if (props[@"fsClass"]) { | |
| set_fsClass(props[@"fsClass"], self); | |
| commandCount++; | |
| } | |
| if (props[@"fsTagName"]) { | |
| set_fsTagName(props[@"fsTagName"], self); | |
| commandCount++; | |
| } | |
| if (props[@"dataElement"]) { | |
| set_dataElement(props[@"dataElement"], self); | |
| commandCount++; | |
| } | |
| if (props[@"dataSourceFile"]) { | |
| set_dataSourceFile(props[@"dataSourceFile"], self); | |
| commandCount++; | |
| } | |
| if (props[@"dataComponent"]) { | |
| set_dataComponent(props[@"dataComponent"], self); | |
| commandCount++; | |
| } | |
| if (props.count != commandCount) { | |
| NSLog(@"FullStory: WARNING: Unrecognized command found in batch property command keys %@", [props allKeys]); | |
| } |
VAL-9554
Overview
This refactoring changes from multiple individual native calls (one per property) to a single batched call. It attempts to reduce race conditions with React Native's rendering scheduler for the new architecture.