[backend/database] Fix DatabaseContext.ReloadEntityRecursivelyAsync
This commit is contained in:
parent
4c3a140e9f
commit
ab5258237d
3 changed files with 4 additions and 4 deletions
|
@ -1144,13 +1144,13 @@ public class DatabaseContext(DbContextOptions<DatabaseContext> options)
|
||||||
await Entry(entity).ReloadAsync();
|
await Entry(entity).ReloadAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReloadEntityRecursiveAsync(object entity)
|
public async Task ReloadEntityRecursivelyAsync(object entity)
|
||||||
{
|
{
|
||||||
await ReloadEntityAsync(entity);
|
await ReloadEntityAsync(entity);
|
||||||
await Entry(entity)
|
await Entry(entity)
|
||||||
.References.Where(p => p is { IsLoaded: true, TargetEntry: not null })
|
.References.Where(p => p is { IsLoaded: true, TargetEntry: not null })
|
||||||
.Select(p => p.TargetEntry!.ReloadAsync())
|
.Select(p => p.TargetEntry!.ReloadAsync())
|
||||||
.AwaitAllAsync();
|
.AwaitAllNoConcurrencyAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQueryable<Note> NoteAncestors(string noteId, int depth)
|
public IQueryable<Note> NoteAncestors(string noteId, int depth)
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class UserResolver(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
await db.ReloadEntityRecursiveAsync(user);
|
await db.ReloadEntityRecursivelyAsync(user);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
@ -782,7 +782,7 @@ public class UserService(
|
||||||
await task.SafeWaitAsync(TimeSpan.FromMilliseconds(500));
|
await task.SafeWaitAsync(TimeSpan.FromMilliseconds(500));
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
await db.ReloadEntityRecursiveAsync(user);
|
await db.ReloadEntityRecursivelyAsync(user);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue