-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feat: Optimistic writes #210
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
todo:
|
…te APIs; add consumed offset check in receive hook
…Did; update createPost to accept createdAt parameter; add new dependency for common-web
…d when atproto comment created
…ure proper async handling; add logging for delete operations
…ions; update related types and API calls
…te createVote and related functions for improved readability and maintainability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewd the db/
changes yet but overall implementation looks good.
@@ -46,7 +46,7 @@ export const Post = sqliteTable( | |||
{ | |||
id: integer("id").primaryKey(), | |||
rkey: text("rkey").notNull(), | |||
cid: text("cid").notNull().unique(), | |||
cid: text("cid").notNull().default(""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not remove the non null constraint here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a hard dependency on cids for strong refs currently and if we wanna remove this and make it actually nullable it should be done in a future PR I think
export type ApiCreateVoteInput = { | ||
subject: { | ||
rkey: string; | ||
cid: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used, should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's used as a strong ref on line 41 for referencing the subject
|
||
const bskyProfile = await getBlueskyProfile(user.did); | ||
|
||
await sendDiscordMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to go in the receive hook so that it's called on out-of-AppView writes also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it already is as well
… return values for post, vote, and comment retrieval, and ensuring proper async handling in delete operations
…ate logic; add checks to prevent redundant deletions and enhance error handling
… post, and comment actions; enhance validation to ensure users can only act on their own content
Description
Add optimistic writes to the solution, allowing to write to the db before ingestion and opens us up to be able to use useOptimistic()
Does this fix an issue? If so:
Fixes #207
Type of change
Please delete options that are not relevant.
Checklist:
todo:
usefor a later PRuseOptimistic()
to provide optimistic state while waiting for db