Skip to content

Commit d19271a

Browse files
committed
fix: ProfileExplorer does not highlight keys that were just added
1 parent 5b110f8 commit d19271a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: plugins/plugin-codeflare/src/components/ProfileExplorer.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,13 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
389389
}
390390

391391
private treeNode(id: string, meta: Metadata, value: string) {
392-
const justChanged = this.props.profilesDiff && this.props.profilesDiff[id]
392+
// the `json-diff` npm has this behavior: for changed keys, the
393+
// diff object will use that key (hence the `profilesDiff[id]`
394+
// check); for added keys, the diff object will use a key
395+
// `${id}__added`, and hence the second check
396+
const justChanged =
397+
this.props.profilesDiff && (this.props.profilesDiff[id] || this.props.profilesDiff[id + "__added"])
398+
393399
const title = (
394400
<span>
395401
{meta.title}

0 commit comments

Comments
 (0)