facebook / facebook/lexical

Bug: lexical-yjs create nodes using constructor without args

Open
#4,912 21 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

The `createLexicalNodeFromCollabNode` function creates a node using the constructor without arguments, and then synchronizes the properties using `collabNode`.

This can be fatal if the constructor requires arguments. It is dangerous to call a constructor in a way that was not designed by the user.

Lexical version: 0.12.0

## Steps To Reproduce

1. Use a node whose constructor throws an error if an argument does not exist with collab mode.

## The current behavior
Error is thrown.

## The expected behavior
No error is thrown.

Contributor guide

Open the contributing guide

Research direction

Start at the createLexicalNodeFromCollabNode function and reproduce the issue with a node constructor that throws when its argument is missing. Trace how the collabNode properties are synchronized and verify that collab mode can create the node without throwing when the constructor requires arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.