Skip to content

Commit

Permalink
Differ: improvements to logging
Browse files Browse the repository at this point in the history
Summary:
First, I make the breadcrumbs mechanism (landed just this week) more readable - I forgot to add separators between the breadcrumbs.

Second, there is a path that I am 99% sure we never hit. I've had comments to that effect for a ~year, but now I'm adding a falsey assert. If we don't hit it in prod after a few months I'll be more comfortable just deleting the branch entirely (while probably keeping the assert).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27697786

fbshipit-source-id: 6d74d1703b2212d069fbed510f2655ec17294458
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed Apr 15, 2021
1 parent c83562e commit 5eba5c1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ReactCommon/react/renderer/mounting/Differentiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#ifdef DEBUG_LOGS_BREADCRUMBS
#define BREADCRUMB_TYPE std::string
#define DIFF_BREADCRUMB(X) (breadcrumb + std::string(X))
#define DIFF_BREADCRUMB(X) (breadcrumb + " - " + std::string(X))
#define CREATE_DIFF_BREADCRUMB(X) std::to_string(X)
#else

Expand Down Expand Up @@ -680,6 +680,9 @@ static void calculateShadowViewMutationsFlattener(
// testing on lots of randomized and pathologically
// constructed trees) but I'm leaving this here out of an
// abundance of caution.
// In theory, this path should never be hit. If we don't see
// this in dev after a few months, let's delete this path.
react_native_assert(false);
mutationInstructionContainer.deleteMutations.push_back(
ShadowViewMutation::DeleteMutation(
oldFlattenedNode.shadowView));
Expand Down Expand Up @@ -1351,7 +1354,9 @@ static void calculateShadowViewMutationsV2(
<< oldIndex << ": [" << oldChildPair.shadowView.tag << "]"
<< (oldChildPair.flattened ? " (flattened)" : "")
<< (oldChildPair.isConcreteView ? " (concrete)" : "")
<< " with parent: [" << parentShadowView.tag << "]";
<< " with parent: [" << parentShadowView.tag << "] "
<< "node is in other tree? "
<< (oldChildPair.inOtherTree ? "yes" : "no");
});

if (oldChildPair.isConcreteView) {
Expand Down

0 comments on commit 5eba5c1

Please sign in to comment.