Skip to content

Commit

Permalink
fix(core): load fragments from other session
Browse files Browse the repository at this point in the history
  • Loading branch information
blakebyrnes committed Jan 18, 2022
1 parent 3e964d0 commit 8145a01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/lib/CoreSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default class CoreSession implements IJsPathEventTarget {
prefetchedJsPaths: IJsPathResult[];
}[]
>('Session.loadAllFragments', sessionId);
if (!fragments) return [];
return fragments.map(fragment => {
const coreTab = new CoreTab(
{ ...fragment.detachedTab, sessionName: this.sessionName },
Expand Down
9 changes: 7 additions & 2 deletions core/lib/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,13 @@ export default class Session
prefetchedJsPaths: IJsPathResult[];
}[]
> {
await this.db.flush();
const fragments = this.db.fragments.all();
let db = this.db;
if (fromSessionId === this.id) {
db.flush();
} else {
db = SessionDb.getCached(fromSessionId);
}
const fragments = db.fragments.all();
return await Promise.all(
fragments.map(async fragment => {
const { name, frameNavigationId, domChangeEventIndex } = fragment;
Expand Down

0 comments on commit 8145a01

Please sign in to comment.