Skip to content

Commit

Permalink
Merge pull request #18539 from emberjs/stable-render-node
Browse files Browse the repository at this point in the history
[BUGFIX release] Add ID to `CapturedRenderNode`
  • Loading branch information
chancancode authored Nov 8, 2019
2 parents 5e5de19 + 2d5e925 commit 21de1e5
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface InternalRenderNode<T extends object> extends RenderNode {
}

export interface CapturedRenderNode {
id: string;
type: RenderNodeType;
name: string;
args: ReturnType<CapturedArguments['value']>;
Expand All @@ -33,7 +34,7 @@ export interface CapturedRenderNode {
let GUID = 0;

export class Ref<T extends object> {
private id: number = GUID++;
readonly id: number = GUID++;
private value: Option<T>;

constructor(value: T) {
Expand Down Expand Up @@ -157,7 +158,7 @@ export default class DebugRenderTree<Bucket extends object = object> {
let state = ref.get();

if (state) {
captured.push(this.captureNode(state));
captured.push(this.captureNode(`render-node:${ref.id}`, state));
} else {
refs.delete(ref);
}
Expand All @@ -166,12 +167,12 @@ export default class DebugRenderTree<Bucket extends object = object> {
return captured;
}

private captureNode(state: Bucket): CapturedRenderNode {
private captureNode(id: string, state: Bucket): CapturedRenderNode {
let node = this.nodeFor(state);
let { type, name, args, instance, refs } = node;
let bounds = this.captureBounds(node);
let children = this.captureRefs(refs);
return { type, name, args: args.value(), instance, bounds, children };
return { id, type, name, args: args.value(), instance, bounds, children };
}

private captureBounds(node: InternalRenderNode<Bucket>): CapturedRenderNode['bounds'] {
Expand Down

0 comments on commit 21de1e5

Please sign in to comment.