feat: sort users and projects by last activity by default#3103
Conversation
Greptile SummaryThis PR changes the default sort order for the Users list (
Confidence Score: 4/5Safe to merge once the backend dependency (appwrite#12645) is deployed and the search+ordering combination has been manually verified. The diff is minimal and the intent is clear. The main uncertainty is whether combining Both changed files carry the same risk: the search-with-ordering path. Important Files Changed
|
| users: await sdk.forProject(params.region, params.project).users.list({ | ||
| queries: [Query.limit(limit), Query.offset(offset), Query.orderDesc('')], | ||
| queries: [Query.limit(limit), Query.offset(offset), Query.orderDesc('accessedAt')], | ||
| search | ||
| }) |
There was a problem hiding this comment.
Search + accessedAt ordering may conflict
The search string is passed as a separate top-level parameter alongside Query.orderDesc('accessedAt') in queries. Users who have never logged in will have a null accessedAt, so they'll always sort to the bottom regardless of search relevance — this is probably fine. The harder edge is whether the backend allows ordering by accessedAt when search is also provided: no other page in the codebase pairs a non-empty orderDesc field with the search param, so this is an untested combination. If the dependent backend PR (appwrite#12645) doesn't explicitly support ordering-with-search, this will break search on the Users page with a query error.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
@greptile Search + orderDesc('accessedAt') combination works fine, tested on staging — returns results correctly. Safe to merge. |
|
The developer has confirmed this works on staging — the search + Good to go — if it's been validated on staging against the backend, the concern about the untested ordering-with-search combination is resolved. Thanks for confirming! |
Summary
/auth) now defaults toorderDesc('accessedAt')— most recently active users appear firstorderDesc('accessedAt')— most recently accessed projects appear first