[Bug]: Added nodes not showing up
StatsProIO opened this issue · comments
Stats Pro 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
Version
v1.1.3
Expected Behavior
Player is not adding in nodes from the adds
of events. Only the nodes in the initial type:2
event are being rendered.
Actual Behavior
Player should be adding the nodes defined in the adds
section of events.
Steps to Reproduce
- Use the Replayer to record
let events = [];
function startRecording() {
rrweb.record({
emit(event) {
// push event into the events array
events.push(event);
}
})
};
// this function will send events to the backend and reset the events array
function save() {
const body = JSON.stringify({ events });
events = [];
fetch('http://localhost/api/replay', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body,
});
}
// save events every 10 seconds
setInterval(save, 10 * 1000);
startRecording();
</script>
- In my case, I got these events http://jsonblob.com/1247747721887866880
- Here is an example player playing those events https://rrwebdebug.com/play/index.html?url=http%3A%2F%2Fjsonblob.com%2F1247747721887866880&version=0.7.14&play=on
You can see there is an event which contains "Easy to use web analytics, no cookie banner needed!" but that is not rendered on the page.
Here is the page that was recorded
Testcase Gist URL
Additional Information
No response
Stats Pro commented
Figured it out. It was 2 things:
- Laravel, the framework I use automatically converts empty strings into nulls, this had to be stopped
- json_encode in PHP automatically escapes slashes, this had to be stopped.