ui: force getting url for location in tabmanagers
This commit is contained in:
parent
9d160abda5
commit
cb55a17227
4 changed files with 22 additions and 16 deletions
|
|
@ -124,13 +124,9 @@ export default class ListWalker<T extends Timed> {
|
||||||
* Assumed that the current message is already handled so
|
* Assumed that the current message is already handled so
|
||||||
* if pointer doesn't change <null> is returned.
|
* if pointer doesn't change <null> is returned.
|
||||||
*/
|
*/
|
||||||
moveGetLast(t: number, index?: number): T | null {
|
moveGetLast(t: number, index?: number, force?: boolean, debug?: boolean): T | null {
|
||||||
let key: string = 'time'; // TODO
|
const key: string = index ? '_index' : 'time';
|
||||||
let val = t;
|
const val = index ? index : t;
|
||||||
if (index) {
|
|
||||||
key = '_index';
|
|
||||||
val = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
let changed = false;
|
let changed = false;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
@ -143,7 +139,10 @@ export default class ListWalker<T extends Timed> {
|
||||||
this.movePrev();
|
this.movePrev();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
return changed ? this.list[this.p - 1] : null;
|
if (debug) {
|
||||||
|
console.log(this.list[this.p - 1])
|
||||||
|
}
|
||||||
|
return changed || force ? this.list[this.p - 1] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
prevTs = 0;
|
prevTs = 0;
|
||||||
|
|
|
||||||
|
|
@ -288,15 +288,17 @@ export default class MessageManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tabId) {
|
if (tabId) {
|
||||||
|
const stateUpdate: { currentTab?: string, tabs?: Set<string> } = {}
|
||||||
if (this.activeTab !== tabId) {
|
if (this.activeTab !== tabId) {
|
||||||
this.state.update({ currentTab: tabId });
|
stateUpdate['currentTab'] = tabId;
|
||||||
this.activeTab = tabId;
|
this.activeTab = tabId;
|
||||||
this.tabs[this.activeTab].clean();
|
this.tabs[this.activeTab].clean();
|
||||||
}
|
}
|
||||||
const activeTabs = this.state.get().tabs;
|
const activeTabs = this.state.get().tabs;
|
||||||
if (activeTabs.size !== this.activeTabManager.tabInstances.size) {
|
if (activeTabs.size !== this.activeTabManager.tabInstances.size) {
|
||||||
this.state.update({ tabs: this.activeTabManager.tabInstances });
|
stateUpdate['tabs'] = this.activeTabManager.tabInstances;
|
||||||
}
|
}
|
||||||
|
this.state.update(stateUpdate)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tabs[this.activeTab]) {
|
if (this.tabs[this.activeTab]) {
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ export default class TabSessionManager {
|
||||||
private readonly state: Store<{
|
private readonly state: Store<{
|
||||||
tabStates: { [tabId: string]: TabState };
|
tabStates: { [tabId: string]: TabState };
|
||||||
tabNames: { [tabId: string]: string };
|
tabNames: { [tabId: string]: string };
|
||||||
|
location?: string;
|
||||||
}>,
|
}>,
|
||||||
private readonly screen: Screen,
|
private readonly screen: Screen,
|
||||||
private readonly id: string,
|
private readonly id: string,
|
||||||
|
|
@ -415,14 +416,16 @@ export default class TabSessionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* === */
|
/* === */
|
||||||
const lastLocationMsg = this.locationManager.moveGetLast(t, index);
|
const lastLocationMsg = this.locationManager.moveGetLast(t, index, true);
|
||||||
if (lastLocationMsg) {
|
if (lastLocationMsg) {
|
||||||
const { tabNames } = this.state.get();
|
const { tabNames, location } = this.state.get();
|
||||||
if (lastLocationMsg.documentTitle) {
|
if (location !== lastLocationMsg.url) {
|
||||||
tabNames[this.id] = lastLocationMsg.documentTitle;
|
if (lastLocationMsg.documentTitle) {
|
||||||
|
tabNames[this.id] = lastLocationMsg.documentTitle;
|
||||||
|
}
|
||||||
|
// @ts-ignore comes from parent state
|
||||||
|
this.state.update({ location: lastLocationMsg.url, tabNames });
|
||||||
}
|
}
|
||||||
// @ts-ignore comes from parent state
|
|
||||||
this.state.update({ location: lastLocationMsg.url, tabNames });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastPerformanceTrackMessage =
|
const lastPerformanceTrackMessage =
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,8 @@ export default class WebPlayer extends Player {
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.playerJumpToTime = this.jump.bind(this);
|
window.playerJumpToTime = this.jump.bind(this);
|
||||||
|
// @ts-ignore
|
||||||
|
window.__OPENREPLAY_DEV_TOOLS__.player = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
preloadFirstFile(data: Uint8Array, fileKey?: string) {
|
preloadFirstFile(data: Uint8Array, fileKey?: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue