Skip to content

Commit addac8a

Browse files
committed
chore: small refactor
1 parent 964e183 commit addac8a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/core/ui/frame/frame-common.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,18 @@ export class FrameBase extends CustomLayoutView {
151151
public onUnloaded() {
152152
// Property page refers to the page this frame is nested into
153153
const parentFrame = this.page?.frame;
154-
const frameEntryLoadedCallback = this._frameEntryLoadedCallback;
155154

156155
super.onUnloaded();
157-
this._frameEntryLoadedCallback = null;
158156

159157
// This is a precaution in case the method is called asynchronously during the loading procedure
160-
if (parentFrame && frameEntryLoadedCallback) {
161-
parentFrame.off(FRAME_ENTRY_LOADED_EVENT, frameEntryLoadedCallback);
158+
if (this._frameEntryLoadedCallback) {
159+
const cb = this._frameEntryLoadedCallback;
160+
161+
this._frameEntryLoadedCallback = null;
162+
163+
if (parentFrame) {
164+
parentFrame.off(FRAME_ENTRY_LOADED_EVENT, cb);
165+
}
162166
}
163167
}
164168

0 commit comments

Comments
 (0)