-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Verify destruction chain #114
Comments
Another thing I noticed is that models are not unbound from each other. |
A possible blocker: https://github.com/ckeditor/ckeditor5-ui/issues/83. |
ckeditor/ckeditor5-core#186 is invalid link now. I will miss your essay. |
There was no essay. I've been writing down places in the code we need to take into consideration :/ |
There's a big chance that we'll have to work on destroying the engine's view correctly now, because it's causing many issues once we have all tests run in a single scope. The observers are not disabled so there are hard to track issues with relations between tests. I'm not tracking such things in ckeditor/ckeditor5-engine#671. |
BTW. FYI – |
I did some work on this subject and it's done in PR #671 however I am not sure whether it completes this issue because I only focused on view observers. |
When reviewing ckeditor/ckeditor5-core#87 I realised that UI's destruction doesn't work in real life. We implemented it too early, without considering what needs to be done and, as a result of that, it does too much. This leads to conflicts when the editor and plugins try to destroy the pieces of UI introduced by them. But I also realised that it's not only unclear what needs to be done but also how the process should look in general. GoalsSo, first of all, goals:
To sum up – destruction should be about detaching components from the world (their surrounding). Additional work, like reverting DOM changes may also be needed in a limited number of cases (such as removing outermost editor UI elements). Removing references between objects is not needed! If you destroy a component, you (the world) remove a reference to that component, so there's no need for that component to remove references to its children. ProcessTheoretically, it's simple – if you initialise some components in So, e.g. if the editor first loads plugins and then inits the UI, the UI needs to be destroyed before the plugins are destroyed. However, what if one of the plugins created some UI and added it to editor UI's collection? On editor destroy, first the UI will be destroyed (which is recursive and will destroy that plugin's component too) and then the plugins will be destroyed and one of these plugins may want to somehow destroy the component which it created (it might've even initialised it, but usually plugins don't do that). We've got a collision of responsibilities here. I can see two options here:
The second option is definitely a bit messy. We basically give up and avoid the problem by making destruction more forgiving. The first approach is cleaner but there are technical problems that we'd need to tackle. One of them is that UI initialisation is recursive (so it's symmetrical to destruction). If we'll make destruction non-recursive it means that initialisation needs to become non-recursive as well. I'm not sure what implications it brings. The second of them is that in at least two places (plugins, UI) we divided initialisation of a class into two parts – constructor and |
PS. I think that we'll need to touch a bit of code here, especially in the UI lib. We also plan there to work on https://github.com/ckeditor/ckeditor5-ui/issues/225 and there's a high chance that it will make sense to work on both topics at the same time. Trying to do them separately may be a waste of time. Fortunately, AFAIK the destruction process is not a blocker, so we can move it to after alpha. |
I have a very similar case in the If it won't do that – plugins which introduced them will need to do that manually. If it will – you won't be able to unload a plugin or you might destroy a command twice (if a plugin would destroy it too). The first solution is really inconvenient. Just like with the UI, there's a high chance of bugs caused by plugins which forgot to destroy components which they created. So, since |
We discussed this further internally. We made the decision to go the easy way.
|
I read all your comments, @Reinmar and there are things which seem a little bit confusing to me:
|
You're right – we never considered it (openly) and this is a bug – However, it doesn't mean that we will never think about destroying single plugins and thinking how they can destroy the UI they introduced. This is theoretical but worth keeping in the back of our heads.
There should be no need for such a flag at the moment. At least, I don't see any. The biggest issue right now is that UI framework has too aggressive Let's fix both issues that I described in https://github.com/ckeditor/ckeditor5-ui/issues/248#issuecomment-307731282 and see where it gets us. |
We performed a quick tests with @oleq and it seems that there are no significant issues. The only ones I could see were related to retaining some deopt data and minor stuff – nothing big. |
I think that we can close this ticket. New, more detailed ones should be opened for issues that we'll find (and if we'll find them :P). |
Moved from ckeditor/ckeditor5-core#186
The text was updated successfully, but these errors were encountered: