Skip to content

Find() inside of View returning default value? #3875

@xxhollyxx

Description

@xxhollyxx

Views having this strange behavior:
Log.Info((ctx.Db.user.UserId.Find(1231415) == null).HasValue.ToString());
I can type in any random number and it always prints false! Why is this so?
Same result if I do is User
Testing it outside a view, this is not the case.

if (ctx.Db.user.UserId.Find(1231415) is User foundUser)
{
Log.Info(foundUser.ToString()); //This prints the default table (Id = 0 and all default values)
}

How am I supposed to check if a user exists or not? It's always returning the default user (Id 0)

Using Spacetimedb 1.11.0 by the way

UPDATE: Can also confirm this still occurs even when ctx.Db.user.Count == 0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions