ui: force getting url for location in tabmanagers

This commit is contained in:
nick-delirium 2025-03-28 10:57:39 +01:00
parent 9d160abda5
commit cb55a17227
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
4 changed files with 22 additions and 16 deletions

View file

@ -124,13 +124,9 @@ export default class ListWalker<T extends Timed> {
* Assumed that the current message is already handled so
* if pointer doesn't change <null> is returned.
*/
moveGetLast(t: number, index?: number): T | null {
let key: string = 'time'; // TODO
let val = t;
if (index) {
key = '_index';
val = index;
}
moveGetLast(t: number, index?: number, force?: boolean, debug?: boolean): T | null {
const key: string = index ? '_index' : 'time';
const val = index ? index : t;
let changed = false;
// @ts-ignore
@ -143,7 +139,10 @@ export default class ListWalker<T extends Timed> {
this.movePrev();
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;

View file

@ -288,15 +288,17 @@ export default class MessageManager {
}
if (tabId) {
const stateUpdate: { currentTab?: string, tabs?: Set<string> } = {}
if (this.activeTab !== tabId) {
this.state.update({ currentTab: tabId });
stateUpdate['currentTab'] = tabId;
this.activeTab = tabId;
this.tabs[this.activeTab].clean();
}
const activeTabs = this.state.get().tabs;
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]) {

View file

@ -98,6 +98,7 @@ export default class TabSessionManager {
private readonly state: Store<{
tabStates: { [tabId: string]: TabState };
tabNames: { [tabId: string]: string };
location?: string;
}>,
private readonly screen: Screen,
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) {
const { tabNames } = this.state.get();
if (lastLocationMsg.documentTitle) {
tabNames[this.id] = lastLocationMsg.documentTitle;
const { tabNames, location } = this.state.get();
if (location !== lastLocationMsg.url) {
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 =

View file

@ -100,6 +100,8 @@ export default class WebPlayer extends Player {
// @ts-ignore
window.playerJumpToTime = this.jump.bind(this);
// @ts-ignore
window.__OPENREPLAY_DEV_TOOLS__.player = this;
}
preloadFirstFile(data: Uint8Array, fileKey?: string) {