vue-advanced-chat
vue-advanced-chat copied to clipboard
room-id prop - is it working?
I didn't quite understand from the documentation how the room-id prop should work. If I write some room-id on mounted to load messages only for this room, I get an error.
If this is not a bug, then please tell me how to use the room-id correctly to show (fetch) messages for a specific room.
For example, I want to show messages for room 13 using the link:
mychat.com/?chatId=13
Here's what's in the template (Removed unnecessary props just to show):
<vue-advanced-chat
:room-id="currentRoomId"
/>
Data (Removed unnecessary):
data() {
return {
currentRoomId: null,
}
},
Here's what's on mounted
mounted() {
this.loadingRooms = true;
this.messagesLoaded = false;
Nova.request().get(API_PREFIX + 'user')
.then(data => {
...
})
.then(() => {
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
if (params['chatId']) {
this.currentRoomId = parseInt(params['chatId']);
}
})
},
And here is the error:

All prop ids should be strings, have you tried to convert it as a string? Which vue version are you using? Which chat version are you using?
All prop ids should be strings, have you tried to convert it as a string? Which vue version are you using? Which chat version are you using?
Yes, I tried to convert it as a string, same result.
"vue-advanced-chat": "^2.0.3" Vue: 3.2.38
room-id is working fine on my side. Could you give me access to your repo, or reproduce a minimal example so I can reproduce?
room-idis working fine on my side. Could you give me access to your repo, or reproduce a minimal example so I can reproduce?
Okay, I'll put together a project and send it tomorrow (laravel + nova + vue-advanced-chat).
Maybe you can work with mock data, you can use this repo as a sandbox so you don't need to setup a whole project: https://github.com/antoine92190/vue-advanced-chat-sandbox
Maybe you can work with mock data, you can use this repo as a sandbox so you don't need to setup a whole project: https://github.com/antoine92190/vue-advanced-chat-sandbox
Maybe it has something to do exactly with laravel nova. Okay, thanks, I`ll check the sandbox)
@TimurZur Did you have time to create a project or find a solution?
Closing this until I can reproduce the issue
I just wasted 2 hours dealing with this issue. The problem is not that room-id itself has to be a string, but rather that roomId inside your rooms needs to be a string!! Ridiculous...