-
Notifications
You must be signed in to change notification settings - Fork 18
t/225: Made the UI component initialisation and destruction processes synchronous #264
Conversation
🎉 |
); | ||
// If `beforeShow` event is not stopped by any external code then panel will be displayed. | ||
this.once( 'beforeShow', () => { | ||
if ( isStopped ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR, this could've been done using event's cancelling mechanism. Maybe we can change it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related ticket https://github.com/ckeditor/ckeditor5-ui/issues/232.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so let's not do that now.
src/view.js
Outdated
* Destroys the view instance and child views located in {@link #_viewCollections}. | ||
* | ||
* @returns {Promise} A Promise resolved when the destruction process is finished. | ||
f * Destroys the view instance and child views located in {@link #_viewCollections}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typoed "f".
I've scanned through the changes in this repo and they are so simple that if the tests pass I'd risk merging without spending more time. |
Changes in the other repos look good too. |
I'll wait for @oskarwrobel's +1 and merge it. |
@@ -320,7 +295,6 @@ describe( 'ContextualToolbar', () => { | |||
beforeEach( () => { | |||
setData( editor.document, '<paragraph>[bar]</paragraph>' ); | |||
|
|||
// Methods are stubbed because return internal promise which can't be returned in test. | |||
showPanelSpy = sandbox.stub( contextualToolbar, '_showPanel', () => {} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stub
can be changed to spy
.
Are we OK to merge the constellation? |
OK from me. |
Suggested merge commit message (convention)
Other: Made the UI component initialization and destruction processes synchronous. Closes ckeditor/ckeditor5#5355.
BREAKING CHANGE:
View#init
,View#destroy
(alsoViewCollection#init
,ViewCollection#destroy
andViewCollection#add
) no longer returnPromise
. It may require updates in UI components which inherit fromView
and rely on the value returned by these methods.BREAKING CHANGE: Various UI components switched to synchronous
init()
anddestroy()
(no longer returningPromise
), which means that features using these components may need some updates to work properly.Additional information
CI branch is https://github.com/ckeditor/ckeditor5/tree/t/ckeditor5-ui/225, also pointing to related branches in other repositories aligning the API to the changes in this issue. They can't be merged one by one so it's all or nothing merge. CI in https://travis-ci.org/ckeditor/ckeditor5/builds/249943542.
Commit message for related branches:
@oskarwrobel: Can you take a look on
ContextualBalloon
andContextualToolbar
classes? I made them synchronous but AFAIR because of the asynchronous API the tests were full of hacks. Perhaps you may have some ideas as to how to simplify them even more?