3

I have this Jetstream Laravel application, which has a presence channel set up for chat features.

What's happening is:

When I join the channel and send a message there, everything works fine, except when I try to exit the channel. In every navigation link, the error Uncaught DOMException: Failed to execute 'replaceState' on 'History': #<Object> could not be cloned. is triggered.

Not sure what is causing it...

Curious Fact:

When I join the channel, and leave it, without sending any message, it works as expected. I visit the page that I was supposed to visit, without any error.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

1 Answers1

4

You should not change the props who is coming from $page.props.{propName}

Instead if you want to make some changes on a prop like your app {messages}

you should create a new object or array from the prop:

const messages = ref([...page.props.value.messages]);

Now you can change the messages object as many as you want:

messages.push(newMessage)
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459