Clean up drafts implementation #164

Merged
hodlbod merged 1 commits from drafts-cleanup into dev 2026-04-07 13:06:30 +00:00
Owner
No description provided.
hodlbod added 1 commit 2026-04-07 13:02:16 +00:00
hodlbod reviewed 2026-04-07 13:05:30 +00:00
@@ -43,4 +43,2 @@
let {url, h, header, initialValues}: Props = $props()
const draftKey = new DraftKey<CalendarValues>(`calendar:${url}:${h ?? ""}`)
const draft = draftKey.get()
Author
Owner

No need to clutter things with one-off variables

No need to clutter things with one-off variables
@@ -32,2 +32,2 @@
start: number | undefined
end: number | undefined
start?: number
end?: number
Author
Owner

In my review I didn't realize that these had no default values, and so we have to accept optional/undefined.

In my review I didn't realize that these had no default values, and so we have to accept optional/undefined.
@@ -129,1 +116,4 @@
let endDirty = $state(Boolean(initialValues?.end))
let content = $state(initialValues?.content ?? "")
const onChange = (json: object) => {
Author
Owner

Avoid unknown; object isn't much better but it is marginally better.

Avoid unknown; object isn't much better but it is marginally better.
@@ -51,4 +46,0 @@
images?: (string | File)[]
status?: string
topics?: string[]
}
Author
Owner

This is what I meant by creating the additional type, this allows us to name types but avoid duplicating the definitions.

This is what I meant by creating the additional type, this allows us to name types but avoid duplicating the definitions.
@@ -148,7 +145,5 @@ export const makeEditor = async ({
},
})
;(ed as any)._shouldAutofocus = autofocus
Author
Owner

This is a hack; we can just pass the thing straight to EditorCompose

This is a hack; we can just pass the thing straight to EditorCompose
Author
Owner

@userAdityaa this PR is a follow up from #155, just a few things that I thought it would be easier to show rather than tell. Just take a look to get an idea of what I was going for.

@userAdityaa this PR is a follow up from #155, just a few things that I thought it would be easier to show rather than tell. Just take a look to get an idea of what I was going for.
hodlbod merged commit 17fb4e780b into dev 2026-04-07 13:06:30 +00:00
hodlbod deleted branch drafts-cleanup 2026-04-07 13:06:31 +00:00
Collaborator

@userAdityaa this PR is a follow up from #155, just a few things that I thought it would be easier to show rather than tell. Just take a look to get an idea of what I was going for.

Thanks for the review and the fixes! Noted the suggestions, will incorporate these improvements in future PRs.

> @userAdityaa this PR is a follow up from #155, just a few things that I thought it would be easier to show rather than tell. Just take a look to get an idea of what I was going for. Thanks for the review and the fixes! Noted the suggestions, will incorporate these improvements in future PRs.
Sign in to join this conversation.