Skip to content

Commit

Permalink
chore: better typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez0111 committed Jun 8, 2024
1 parent aecc095 commit 2ae6496
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react/src/useEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function makeEditorInstance<TSelectorResult>({
/**
* Always disable the editor on the server-side.
*/
getServerSnapshot() {
return null
getServerSnapshot(): [null, null] {
return [null, null]
},
/**
* Subscribe to the editor instance's changes.
Expand Down Expand Up @@ -200,7 +200,7 @@ function useEditor<TSelectorResult>(options: UseEditorOptions<TSelectorResult> =
})

// Using the `useSyncExternalStore` hook to sync the editor instance with the component state
const editor = useSyncExternalStore(editorInstance.subscribe, editorInstance.getSnapshot, editorInstance.getServerSnapshot)?.[0] || null
const [editor] = useSyncExternalStore(editorInstance.subscribe, editorInstance.getSnapshot, editorInstance.getServerSnapshot)

useDebugValue(editor)

Expand Down

0 comments on commit 2ae6496

Please sign in to comment.