Skip to content

Commit 59cee4d

Browse files
committed
store cloning source on cloned scope
1 parent b9d6337 commit 59cee4d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/hub/src/scope.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ export class Scope implements ScopeInterface {
7575
/** Request Mode Session Status */
7676
protected _requestSession?: RequestSession;
7777

78+
/** If the scope is a clone, the original scope from which the clone derived */
79+
protected _parent?: Scope;
80+
7881
/**
7982
* Inherit values from the parent scope.
8083
* @param scope to clone.
@@ -94,6 +97,7 @@ export class Scope implements ScopeInterface {
9497
newScope._fingerprint = scope._fingerprint;
9598
newScope._eventProcessors = [...scope._eventProcessors];
9699
newScope._requestSession = scope._requestSession;
100+
(newScope as any)._parent = scope;
97101
}
98102
return newScope;
99103
}
@@ -297,6 +301,13 @@ export class Scope implements ScopeInterface {
297301
return this._session;
298302
}
299303

304+
/**
305+
* @inheritDoc
306+
*/
307+
public getParent(): Scope | undefined {
308+
return this._parent;
309+
}
310+
300311
/**
301312
* @inheritDoc
302313
*/

packages/types/src/scope.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ export interface Scope {
132132
*/
133133
setRequestSession(requestSession?: RequestSession): this;
134134

135+
/**
136+
* The scope from which this scope was cloned, if any
137+
*/
138+
getParent(): Scope | undefined;
139+
135140
/**
136141
* Updates the scope with provided data. Can work in three variations:
137142
* - plain object containing updatable attributes

0 commit comments

Comments
 (0)