Skip to content

Commit

Permalink
Merge branch 'next' into corel
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanl17 committed Jan 17, 2025
2 parents 4b2d6c8 + ad3fd48 commit bc92a49
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,18 +644,18 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => {
patchRef.current = () => {
throw new Error('Attempted to patch a read-only document')
}
}
} else {
// note: this needs to happen in an insertion effect to make sure we're ready to receive patches from child components when they run their effects initially
// in case they do e.g. `useEffect(() => props.onChange(set("foo")), [])`
// Note: although we discourage patch-on-mount, we still support it.
patchRef.current = (event: PatchEvent) => {
// when creating a new draft
if (!editState.draft && !editState.published) {
telemetry.log(CreatedDraft)
}

// note: this needs to happen in an insertion effect to make sure we're ready to receive patches from child components when they run their effects initially
// in case they do e.g. `useEffect(() => props.onChange(set("foo")), [])`
// Note: although we discourage patch-on-mount, we still support it.
patchRef.current = (event: PatchEvent) => {
// when creating a new draft
if (!editState.draft && !editState.published) {
telemetry.log(CreatedDraft)
patch.execute(toMutationPatches(event.patches), initialValue.value)
}

patch.execute(toMutationPatches(event.patches), initialValue.value)
}
}, [editState.draft, editState.published, initialValue.value, patch, telemetry, readOnly])

Expand Down

0 comments on commit bc92a49

Please sign in to comment.