jodit / jodit/jodit-react

Uncaught TypeError: Cannot read property 'destruct' of null

Open
#106 14 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
406
Forks
131
Avg merge
2h 32m
Merged PRs (30d)
2

Description

When I go to save I get this error:

app.js:formatted:6369 Uncaught TypeError: Cannot read property 'destruct' of null
    at app.js:formatted:6369
    at HTMLUnknownElement.callCallback (vendor.js:23251)
    at Object.invokeGuardedCallbackDev (vendor.js:23300)
    at invokeGuardedCallback (vendor.js:23362)
    at flushPassiveEffectsImpl (vendor.js:42844)
    at unstable_runWithPriority (app.js:formatted:36153)
    at runWithPriority$1 (vendor.js:30582)
    at flushPassiveEffects (vendor.js:42748)
    at vendor.js:42780
    at workLoop (app.js:formatted:36097)

The formatted vendor code is:

Object(e.useEffect)((function() {
    var t = u.current;
    return u.current = a.Jodit.make(t, i),
    u.current.workplace.tabIndex = c || -1,
    u.current.events.on("blur", (function(t) {
        return l && l(t)
    }
    )),
    u.current.events.on("change", (function(t) {
        return s && s(t)
    }
    )),
    d && (t.id = d),
    n && (t.name = n),
    "function" == typeof p && p(u.current),
    function() {
        u.current.destruct(),
        u.current = t
    }
}

Which seems to be this source code:
In particular line 47

https://github.com/jodit/jodit-react/blob/9497b6769402160e9302797558509702c6579673/src/JoditEditor.js#L30-L50

I'm wondering if the SPA navigates away and the referenced element no longer exists?
If I breakpoint the code it doesn't break, and doesn't navigate away, but if I remove the breakpoint it goes back to breaking.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the save-time error and read src/JoditEditor.js around lines 30-50, especially the useEffect cleanup shown in the report. Trace when the editor reference becomes null and confirm the completed behavior by saving without triggering the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.