fix(ui): jump to first event in session automatically

This commit is contained in:
nick-delirium 2023-03-31 11:24:14 +02:00
parent cf728eb310
commit 848520790b
6 changed files with 20 additions and 2 deletions

View file

@ -84,6 +84,10 @@ function WebPlayer(props: any) {
if (activeTab === '' && !showNoteModal && isPlayerReady) {
contextValue.player && contextValue.player.play()
}
const visualOffset = contextValue.player?.checkVisualOffset?.() || 0
if (visualOffset !== 0) {
contextValue.player.jump(visualOffset)
}
}, [activeTab, isPlayerReady, showNoteModal])
// LAYOUT (TODO: local layout state - useContext or something..)

View file

@ -23,6 +23,7 @@ export function createWebPlayer(session: Record<string, any>, wrapStore?: (s:IWe
}
const player = new WebPlayer(store, session, false)
window.__or_player = player;
return [player, store]
}

View file

@ -116,6 +116,7 @@ export default class MessageManager {
private sessionStart: number;
private navigationStartOffset: number = 0;
private lastMessageTime: number = 0;
public firstVisualEvent: number = 0;
constructor(
private readonly session: any /*Session*/,
@ -467,6 +468,7 @@ export default class MessageManager {
default:
switch (msg.tp) {
case MType.CreateDocument:
if (this.firstVisualEvent === 0) this.firstVisualEvent = msg.time;
this.windowNodeCounter.reset();
this.performanceTrackManager.setCurrentNodesCount(this.windowNodeCounter.count);
break;

View file

@ -66,7 +66,6 @@ export default class WebPlayer extends Player {
// @ts-ignore
window.playerJumpToTime = this.jump.bind(this)
}
updateLists = (session: any) => {
@ -147,6 +146,10 @@ export default class WebPlayer extends Player {
this.screen.cursor.showTag(name)
}
checkVisualOffset = () => {
return this.messageManager.firstVisualEvent
}
clean = () => {
super.clean()
this.screen.clean()

View file

@ -1,5 +1,12 @@
# 6.0.1
- fix webworker writer re-init request
- remove useless logs
# 6.0.0
**(Compatible with OpenReplay v1.11.0+ only)**
- **[breaking]:** Capture mouse thrashing, input hesitation+duration, click hesitation
- Capture DOM node drop event (>30% nodes removed)
- Capture iframe network requests
@ -18,7 +25,9 @@
- Use `@medv/finder` instead of our own implementation of `getSelector` for better clickmaps experience
## 5.0.0
**(Compatible with OpenReplay v1.10.0+ only)**
- **[breaking]:** string dictionary to reduce session size
- Added "tel" to supported input types
- Added `{ withCurrentTime: true }` to `tracker.getSessionURL` method which will return sessionURL with current session's timestamp

View file

@ -142,7 +142,6 @@ export default function (app: App, options?: MouseHandlerOptions): void {
const acceleration = (nextVelocity - velocity) / shakeCheckInterval
if (directionChangeCount > 3 && acceleration > shakeThreshold) {
console.log('Mouse shake detected!')
app.send(MouseThrashing(now()))
}