Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing sort keys in various responses that return lists of ProfileView #3368

Open
tunjid opened this issue Jan 14, 2025 · 0 comments
Open

Comments

@tunjid
Copy link

tunjid commented Jan 14, 2025

Is your feature request related to a problem? Please describe.

I'm building an open-source offline-first client for bluesky uing Compose Multiplatform: https://github.com/tunjid/heron.

Requests typically load data from a local database first, with calls to the API to refresh the local database. Certain endpoints do not return information that allow local sorting however, making combining local requests with updates from the network impossible.

A summary of endpoints without the desired behavior and those with the behavior are summarized in the table below:

Endpoint Model Type sort key Returned in API Response
getFollows ProfileView ?? No
getFollowers ProfileView ?? No
getRepostedBy ProfileView ?? No
getLikes GetLikesLike indexedAt Yes
getTimeline FeedViewPost indexedAt Yes
getFeed FeedViewPost indexedAt Yes
getListFeed FeedViewPost indexedAt Yes
getAuthorFeed FeedViewPost indexedAt Yes

Describe the solution you'd like

It would appear the issues tend to be with endpoints that return a ProfileView. I assume:

getFollows: Sorted by the time a profile was followed
getFollowers: Sorted by the time a profile added a follower
getRepostedBy: Sorted by the time a post was reposted.

All of these are similar to the case of getLikes, however getLikes wraps the ProfileView instances returned in the following structure with the requisite information:

public data class GetLikesLike(
  public val indexedAt: Timestamp,
  public val createdAt: Timestamp,
  public val actor: ProfileView,
)

This can be applied to getFollows, getFollowers and getRepostedBy, allowing for local sorting of the query to resolve with the network response when available.

Describe alternatives you've considered

Coming up with a best guess heuristic to approximate network sort keys locally.

Additional context

Similar and related issues:

#1574
#3342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant