Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

t/225: Made the UI component initialisation and destruction processes synchronous #264

Merged
merged 15 commits into from
Jul 5, 2017

Conversation

oleq
Copy link
Member

@oleq oleq commented Jul 4, 2017

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 (also ViewCollection#init, ViewCollection#destroy and ViewCollection#add) no longer return Promise. It may require updates in UI components which inherit from View and rely on the value returned by these methods.

BREAKING CHANGE: Various UI components switched to synchronous init() and destroy() (no longer returning Promise), 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:

Internal: Updated the usage of UI components which are now driven by synchronous initialization and destruction (see ckeditor/ckeditor5#5355).

@oskarwrobel: Can you take a look on ContextualBalloon and ContextualToolbar 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?

@oleq oleq requested review from Reinmar and oskarwrobel July 4, 2017 11:27
@Reinmar
Copy link
Member

Reinmar commented Jul 4, 2017

🎉

);
// If `beforeShow` event is not stopped by any external code then panel will be displayed.
this.once( 'beforeShow', () => {
if ( isStopped ) {
Copy link
Member

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typoed "f".

@Reinmar
Copy link
Member

Reinmar commented Jul 4, 2017

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.

@Reinmar
Copy link
Member

Reinmar commented Jul 4, 2017

Changes in the other repos look good too.

@Reinmar
Copy link
Member

Reinmar commented Jul 4, 2017

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', () => {} );
Copy link
Contributor

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.

@oleq
Copy link
Member Author

oleq commented Jul 4, 2017

Are we OK to merge the constellation?

@Reinmar
Copy link
Member

Reinmar commented Jul 4, 2017

OK from me.

@Reinmar Reinmar merged commit 07e1502 into master Jul 5, 2017
@Reinmar Reinmar deleted the t/225 branch July 5, 2017 09:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do we need support for asynchronous components initialisation?
3 participants