question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: How to debug OnChangePlugin not firing?

See original GitHub issue

I’m following the code sandbox example provided here: https://codesandbox.io/s/lexical-plain-text-example-g932e

and as far as I can tell there are no meaningful differences between the sandbox example and what I’m running locally, but my OnChangePlugin does not fire.

I’ve replaced the body of the onChange function with the following and do not see this in my logs:

              onChange={(editorState, editor) => {
                console.log('on change');
              }}

The AutoFocusPlugin works correctly and I see the blinking cursor. When I type, I do not see any text updates. I’m not setting anything for initialConfig.editorState. I did have this working at some point back on the 0.2.1 version but recently updated due to some placeholder formatting issues.

Any help would be appreciated 🙏

Package versions:

"@lexical/react": "0.3.5",
"react": "18.1.0",
"react-dom": "18.1.0"

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
6peterlucommented, Jun 19, 2022

I figured it out! I had upgraded my @lexical/react package but not lexical. lexical was still stuck at 0.2.4. After upgrading it to 0.3.5, everything’s working again! Thanks for all the help and my apologies for not including a sandbox. Things were working in the sandbox as you demonstrated so my issue was figuring out what was different between the sandbox and my local haha.

Thanks again @always-maap and @harish-sethuraman 🙏

1reaction
harish-sethuramancommented, Jun 19, 2022

I guess may be you missed to fix the import from default import to named import? (This is what I missed while migrating from older version to new one)

you have to do import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";

Read more comments on GitHub >

github_iconTop Results From Across the Web

onChange doesn't fire if input re-renders due to a setState() in ...
When I added debugger statements within the relevant useEffect hook I could see the text appear in the input then disappear within the...
Read more >
onchange function not getting triggered in custom wordpress ...
Try like this. jQuery(document).ready(function($){ $(document).on('change','#city_id', function(){ alert("Function Called"); }); });.
Read more >
OnChange not working for type Encrypted text - ServiceNow
Hi, I create a field with type Encrypted Text, I add a client script (onchange) on that field, but my script it's not...
Read more >
[ZK-3565] spinner instant=true not firing onChange - ZK-Tracker
spinner instant=true not firing onChange ... Debug Info. works in 8.0.2 ... Bug - A problem which impairs or prevents the functions of...
Read more >
Activation Events | Visual Studio Code Extension API
onDebugResolve :type is fired just before the resolveDebugConfiguration method ... views contributed by your extension do not require a corresponding onView ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found