Skip to content

Commit

Permalink
refactor(react): rephrase error message
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Aug 30, 2024
1 parent 24cfa99 commit 844e7d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .yarn/versions/3198904d.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@codemirror-toolkit/react": patch
6 changes: 3 additions & 3 deletions packages/react/src/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ export function createCodeMirror<ContainerElement extends Element>(
}

const useViewDispatch: UseViewDispatchHook = () =>
useCallback((...specs) => {
useCallback((...transactions) => {
const view = getView()
if (!view) {
throw new TypeError('Cannot dispatch transaction without a view')
throw new ReferenceError('dispatch called before view is initialized')
}
// @ts-expect-error: overloaded signature
view.dispatch(...specs)
view.dispatch(...transactions)
}, [])

function createContainerRef(): ContainerRef<ContainerElement> {
Expand Down

0 comments on commit 844e7d4

Please sign in to comment.