const { error: insertPlayerError } = await supabase
.from("room_players")
.insert({ room_id: id });
if (insertPlayerError) {
throw insertPlayerError;
}
const { data: joinedPlayers, error: selectPlayersError } = await supabase
.from("room_players")
.select('player_id')
.eq('room_id', id);
if (selectPlayersError) {
throw selectPlayersError;
}
The problem here is that joinedPlayers does not include the player inserted right before, what could be the issue? No errors are thrown and row is inserted successfully when viewing table in dashboard.
I know I could take data from insert operation and add it to joinedPlayers, but shouldn't it work the way it is?