Closed zachmullen closed 3 years ago
@jbeezley would it make more sense to change the accepted type from Optional[User]
to just User
? Then we could force there to be a 'user' field in the serializer context.
EDIT: I've convinced myself that I should do that.
would it make more sense to change the accepted type from
Optional[User]
to justUser
?
Good idea. If user
isn't in the context, let it die immediately at runtime.
This brought the time of listing 7 folders from ~3 sec to around ~250ms in the anonymous user case. This was a simple matter of not correctly detecting anonymous users, for which we have an optimized path.
Let's merge this and I'll follow up with other optimizations in other PRs.