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

Exception after changing a route while using CKEditorContext #349

Closed
Mgsy opened this issue Dec 5, 2022 · 2 comments · Fixed by #353
Closed

Exception after changing a route while using CKEditorContext #349

Mgsy opened this issue Dec 5, 2022 · 2 comments · Fixed by #353
Assignees
Labels
squad:platform Issue to be handled by the Platform team. support:2 An issue reported by a commercially licensed client. type:bug
Milestone

Comments

@Mgsy
Copy link
Member

Mgsy commented Dec 5, 2022

Steps to reproduce

Generic steps to reproduce

  1. Create an app with <CKEditorContext /> and two routes - one for the sample and the second one for a blank HTML page.
  2. After initializing the editor, change the route.

Scenario with demo

  1. Download the demo project (real-time-collaboration-for-react.zip) and run it.
  2. After initializing the editor, click on the Page 2 button.

Current result

There are errors in the console:

index.js:5 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'then')
    at index.js:5:167077
    at new Promise (<anonymous>)
    at sn._destroyEditor (index.js:5:167023)
    at sn.componentWillUnmount (index.js:5:165891)
    at pc (index.js:5:963026)
    at hc (index.js:5:962117)
    at pc (index.js:5:963200)
    at hc (index.js:5:962117)
    at pc (index.js:5:963068)
    at hc (index.js:5:962117)
    
index.js:5 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'model')
    at index.js:5:159067

Notes

Demo anatomy:

src/sample.js - routing definition
src/app.js - the application code

I couldn't reproduce the issue without <CKEditorContext> component.

  • "@ckeditor/ckeditor5-react": "5.0.3"
  • "react": "^18.2.0",
  • "react-dom": "^18.2.0",
  • "react-router-dom": "^6.4.3",
@Mgsy Mgsy added type:bug squad:platform Issue to be handled by the Platform team. support:2 An issue reported by a commercially licensed client. labels Dec 5, 2022
@pomek
Copy link
Member

pomek commented Dec 16, 2022

Debug notes:

To fix the problem, we need to:

  • ckeditor5-react: do not ignore a promise,
  • ckeditor5-watchdog: do not destroy a destroyed editor (it can be tricky to cover with a unit test).

@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Dec 16, 2022
@pomek pomek self-assigned this Dec 19, 2022
@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Dec 19, 2022
@pomek
Copy link
Member

pomek commented Dec 19, 2022

psmyrek added a commit that referenced this issue Dec 22, 2022
Fix: The `<CKEditor>` component does not emit an error when destroying the context feature. Closes #349. Closes #339.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Dec 22, 2022
@CKEditorBot CKEditorBot added this to the iteration 60 milestone Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:platform Issue to be handled by the Platform team. support:2 An issue reported by a commercially licensed client. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants