Fix state resolution applying events out of order, which could undo room joins. Contributed by @eleboucher.