[Bug]: Duplicate player window
fidelis27 opened this issue · comments
Thiago Fidelis commented
Preflight Checklist
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
What package is this bug report for?
rrweb-player
Version
1.0.0-alpha.4
Expected Behavior
I expect only one player to be rendered when opening a modal in react
Actual Behavior
When opening the modal and closing it several times, the player duplicates itself
Steps to Reproduce
` useEffect(() => {
const times: number[] = []
window.replayer = new rrwebPlayer({
target: playerRoot.current,
props: {
events: dataRecording.events,
tags: {
width: String(metadata.width),
height: String(metadata.height),
},
width: device === deviceType.MOBILE ? 297 : 724,
height: device === deviceType.MOBILE ? 380 : 392,
},
})
docs.forEach((doc: { timestamp: number }) => {
times.push(doc.timestamp)
})
}, [dataRecording])`
Testcase Gist URL
No response
Additional Information
I believe that Windows, being global, makes the reaction confusing and creating the player again.