-
Notifications
You must be signed in to change notification settings - Fork 1
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(tiptap): save updates to db + invalidate queries #367
Conversation
wire save through to db
refactor so props correctness handled otuside
invalidate on update
now requires db
update db on save + invalidate old queries
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
content: JSON.stringify({ | ||
...pageContent, | ||
content: previewPageState, | ||
}), |
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.
having to fetch page content just to stringify here isn't ideal and i'll refactor when all our "content updating" features are in
@@ -193,7 +193,7 @@ export const pageRouter = router({ | |||
.mutation(async ({ input }) => { | |||
// @ts-expect-error we need this because we sanitise as a string | |||
// but this accepts a nested JSON object | |||
await updateBlobById({ ...input, pageId: input.pageId }) | |||
await updateBlobById(db, { ...input, pageId: input.pageId }) |
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.
error wasn't caught previously due to @ts-expect-error
.______.
apps/studio/src/features/editing-experience/components/ComplexEditorStateDrawer.tsx
Outdated
Show resolved
Hide resolved
* chore: convert add script * refactor: resource use 2 queries cos inner join + update in same query doesn't work * refactor: component selector update typings * feat: editor drawer context add curr active idx * feat: editpagedrawer update so data is dynamic * chore: componentselector only paragraph uses component selector * chore: update convert function 1. add zod validation 2. simplify the function * chore: component selector * chore: components selector update to correct names * chore: constants update default prose block * feat: convert add convert functions * chore: typings * chore: next state compute next state from block * feat: update update UI on save click * feat: update update pages automatically * chore: rename editorstate * chore: utils delete obsolete function * chore: menubar remove title cos we don't want them to set h1 * chore: remove unused imports * chore: remove json schema setting * fix: tiptap update typings + validation * chore: componentselector update to remove unsafe cast * fix: add snapshot * chore: remove extra memo * chore: fix type errors * chore: remove saving * chore: style run lint + format * chore: fix type errors * chore: style run lint + format * feat: re-order * feat: optimistic loading * feat: page router * fix: run formatter * chore: prose add format * fix: use ref for isomer components schema * fix: prose add format * chore: fix rebase errors * chore: style * chore: rebase fixes * fix: rebase * chore: style * chore: typings * chore: comments * chore: use siteID * chore: style lint fix + style fix * chore: root state drawer use query parse * chore: memo ondragend * chore: update imports * chore: componentselector pas stuff as props to selector * chore: style * chore: onerror shift from inside mutate function to hook * fix: page schema min 0 * fix: page id obtain page id correctly * fix: resource service add forUpdate * fix: blob id conditional * fix: transaction put stuff in tx and use safe kysely type * chore: remove extra dep * chore: component selector remove unused props * ref: db pass db as explicit arg * feat(tiptap): save updates to db + invalidate queries (#367) * fix: complex editor wire save through to db * refactor: complex editor state drawer refactor so props correctness handled otuside * fix: update page invalidate on update * fix: updatePageBlob now requires db * feat: tiptap component update db on save + invalidate old queries * chore: use exported schema * fix: rebase * fix: lint update lint --------- Co-authored-by: Kar Rui Lau <[email protected]>
Problem
Previously,
Prose
wasn't saving to db. Whenuat
added the save to db, there wasnt the query invalidation portion. This PR adds both functionality inSolution
updatePageBlob
hook inTiptapComponent
.Screenshots and video
Screen.Recording.2024-07-25.at.5.51.55.PM.mov