Skip to content
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

Improve error handling for initialContent in BlockNoteEditor #349

Conversation

marwan37
Copy link

Description

The current implementation of BlockNoteEditor does not provide clear error messages when invalid initialContent is passed. This PR improves the error handling by adding more descriptive error messages and checks for required keys in block objects.

fixes: #342

Changes

  • Enhanced error messages in BlockNoteEditor.ts for invalid initialContent.
  • Introduced defaultInitialContent; initialContent defaults to this if checks fail.
  • Changed initialContent from const to let for reassignment (further guidance is appreciated if undesirable).

Testing

  1. When passing a string, e.g. initialContent = "abc":
initialContent-string

  1. When passing an array with non-object elements, e.g. initialContent = ["abc"]:
initialContent-notObject

  1. When passing an array of objects but keys are invalid, e.g. [{ someKey: "abc", id: "123123" }]:
initialContent-invalidKeys

@vercel
Copy link

vercel bot commented Sep 26, 2023

@marwan37 is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error handling for useBlockNote
1 participant