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

LinkFormView#init() is fired after it is destroyed #4776

Closed
scofalik opened this issue Apr 7, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-link#105
Closed

LinkFormView#init() is fired after it is destroyed #4776

scofalik opened this issue Apr 7, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-link#105
Labels
package:link type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@scofalik
Copy link
Contributor

scofalik commented Apr 7, 2017

When running tests for Link feature I discovered interesting thing. All tests passes, but there are a lot of errors in console:
image
@Reinmar suggested that it is connected with the fact that init() is fired asynchronously, after the plugin is already destroyed.

Possible solutions:

  1. Fix tests so this won't happen. Use some promises to handle asynchronous initialization.
  2. Fix Link / LinkFormView code so it won't happen. Make the plugin destroy itself only after it is inited, or maybe just abandon initialisation if the plugin was destroyed.
  3. Or we need a complex solution for destroying editor that will also operate on Promises.
@Reinmar
Copy link
Member

Reinmar commented Apr 7, 2017

First, we should check whether this is not a simple issue in the tests or the code. I guess it is.

However, we'll have to think, at some point, how to handle destroy() calls while init() takes place. This is a general issue which concerns the entire UI and the editor classes. There are two options:

  • throw when a component isn't yet initialised – simple and verbose,
  • automatically defer destroy until the component has been intialised – more problematic and I think quite risky but more graceful.

cc @oleq

@oleq
Copy link
Member

oleq commented Apr 10, 2017

Most certainly it is because ContextualBalloon does not respect asynchronous ViewCollection#add here https://github.com/ckeditor/ckeditor5-ui/blob/t/191/src/contextualballoon.js#L169 and here https://github.com/ckeditor/ckeditor5-ui/blob/t/191/src/contextualballoon.js#L53 and probably somewhere else.

cc @oskarwrobel

oleq referenced this issue in ckeditor/ckeditor5-link Apr 14, 2017
Fix: Link Plugin should manage focus when the balloon is open. Made Link Plugins #showPanel() and #hidePanel() methods protected. Closes #95. Closes #94.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-link Oct 9, 2019
@mlewand mlewand added this to the iteration 10 milestone Oct 9, 2019
@mlewand mlewand added type:bug This issue reports a buggy (incorrect) behavior. package:link labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:link type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants