view_hand being sent and panicking causes logged_out or something else to fail?

This commit is contained in:
Tao Tien 2026-02-25 14:34:05 -08:00
parent baab16144b
commit c68af245af
3 changed files with 6 additions and 4 deletions

View file

@ -139,8 +139,9 @@ pub struct HandView {
#[view(accessor = view_closed_hands, public)]
fn view_closed_hands(ctx: &ViewContext) -> Vec<HandView> {
let this_player = ctx.db.player().identity().find(ctx.sender()).unwrap();
if let Some(lobby) = ctx.db.lobby().id().find(this_player.lobby_id) {
if let Some(this_player) = ctx.db.player().identity().find(ctx.sender())
&& let Some(lobby) = ctx.db.lobby().id().find(this_player.lobby_id)
{
lobby
.players
.iter()

View file

@ -226,12 +226,13 @@ fn on_player_insert_update(
mut commands: Commands,
main_player: Option<Single<&MainPlayer>>,
other_players: Query<&Player>,
other_players: Query<&Player, Without<MainPlayer>>,
mut next_turnstate: ResMut<NextState<jong_types::states::TurnState>>,
) {
for msg in messages.read() {
debug!("on_player_insert_update: {:?}", msg.new);
assert_eq!(msg.new.identity, stdb.identity());
if main_player.is_none() && msg.new.identity == stdb.identity() {
// trace!("spawn_main_player");
spawn_main_player(&stdb, &mut commands, &mut next_turnstate, &msg.new);

View file

@ -165,7 +165,7 @@ pub(crate) fn render_main_hand(
let hand: Vec<_> = hand
.iter()
.find_map(|(c, e)| {
debug!("main_player children: {:?}", *main_player);
// debug!("main_player children: {:?}", *main_player);
if main_player.contains(&e) {
Some(c)
} else {