rrweb-io / rrweb

record and replay the web

Home Page:https://www.rrweb.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Added nodes not showing up

StatsProIO opened this issue · comments

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

  1. 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>
  1. In my case, I got these events http://jsonblob.com/1247747721887866880
  2. 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
Screenshot 2024-06-04 at 11 19 33 PM

But the player only shows
Screenshot 2024-06-04 at 11 24 44 PM

Testcase Gist URL

https://rrwebdebug.com/play/index.html?url=http%3A%2F%2Fjsonblob.com%2F1247747721887866880&version=0.7.14&play=on

Additional Information

No response

Figured it out. It was 2 things:

  1. Laravel, the framework I use automatically converts empty strings into nulls, this had to be stopped
  2. json_encode in PHP automatically escapes slashes, this had to be stopped.