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

feat: update to Electron 12 #2220

Merged
merged 4 commits into from
Apr 22, 2021
Merged

feat: update to Electron 12 #2220

merged 4 commits into from
Apr 22, 2021

Conversation

barmac
Copy link
Contributor

@barmac barmac commented Apr 19, 2021

This introduces context isolation to the app. Because of that,
the remote APIs have changed. Backend does not expose off
method anymore. Use the return value of on and once instead.

Example:

const subscription = backend.on('client:window-focused', listener);

subscription.cancel();

Closes #1926

@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Apr 19, 2021
@barmac barmac marked this pull request as ready for review April 19, 2021 15:34
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Apr 19, 2021
app/lib/preload.js Outdated Show resolved Hide resolved
@@ -22,14 +22,10 @@ const {
flags,
platform,
plugins: appPlugins,
ipcRenderer
api
Copy link
Member

Choose a reason for hiding this comment

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

What is api here? Can we give it a more sensible name? Alternative: Construct the Backend directly in appPreload. Not sure what's the benefit to construct it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Benefits:

  • We don't expose the ipcRenderer methods directly.
  • We can filter events for which send can be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So yeah, I could rename it to ipcRenderer again. However, how does the client benefit from knowing about ipcRenderer?

Copy link
Member

Choose a reason for hiding this comment

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

Does the client benefit from knowing something that is called API?

A solution could be to return the instantiated backend from the pre-load function. This way we do not need to pass around these names at all. Let us try to avoid generics like "api" and "descriptor" in our code. We got a lot of these in there already 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's try that out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented via 0a84217

Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

Some comments inlined.

@barmac
Copy link
Contributor Author

barmac commented Apr 20, 2021

Chromium update shipped with outline changes.

image
image

@barmac
Copy link
Contributor Author

barmac commented Apr 20, 2021

Camunda Modeler 4.7 for comparison

image
image

@andreasgeier
Copy link

We should fix the wrong focus outline style.

// expose api only once
// related to https://github.com/camunda/camunda-modeler/issues/2143
if (executed) {
return;
Copy link
Member

Choose a reason for hiding this comment

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

Could be helpful to blow up here, so we do not silently discard miss-use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
return;
throw new Error('🚔');

Copy link
Member

@nikku nikku Apr 20, 2021

Choose a reason for hiding this comment

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

throw new Error('this is recorded! We\'ll track you down!!!!11^^10815').

@barmac
Copy link
Contributor Author

barmac commented Apr 20, 2021

It seems that we cannot have an exactly identical outline, but the outcome looks OK in my opinion.

image

Screen.Recording.2021-04-20.at.15.30.12.mov

@barmac
Copy link
Contributor Author

barmac commented Apr 20, 2021

Regarding the deployment button, I'll remove the outline as it is not present in 4.7.

@barmac
Copy link
Contributor Author

barmac commented Apr 20, 2021

@barmac
Copy link
Contributor Author

barmac commented Apr 20, 2021

CI fails due to unrelated error 🤪

Copy link

@andreasgeier andreasgeier left a comment

Choose a reason for hiding this comment

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

There are now unwanted focus outlines on several places in the UI:

Diagrams
Screen Shot 2021-04-21 at 11 20 50

Status bar overlay

Screen Shot 2021-04-21 at 11 21 08

Decision table

Screen Shot 2021-04-21 at 11 23 00

@barmac
Copy link
Contributor Author

barmac commented Apr 21, 2021

We discussed the issue and decided on the following:

  • change the default color of the outline to a matching one (will be picked up by non-styled plugins)
  • use "faked" outline for our custom content where we used to base on the user-agent values.

@barmac
Copy link
Contributor Author

barmac commented Apr 21, 2021

CI fails due to unrelated error 🤪

It was because of missing sinon.restore() after I stubbed process.platform.

Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

Works for me. Also smoke tested it on Linux 👍

@nikku
Copy link
Member

nikku commented Apr 21, 2021

Needs approval by @andreasgeier.

This introduces context isolation to the app. Because of that,
the remote APIs have changed. Backend does not expose `off`
method anymore. Use the return value of `on` and `once` instead.

Example:

```javascript
const subscription = backend.on('client:window-focused', listener);

subscription.cancel();
```

Closes #1926
* Use custom color for default outline.
* Replace outline with box-shadow for custom elements.
@barmac
Copy link
Contributor Author

barmac commented Apr 21, 2021

Found one more event thanks to codecov ;) It should be OK now.

Copy link

@andreasgeier andreasgeier left a comment

Choose a reason for hiding this comment

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

I did a quick exploratory test through the user interface and found no more outline problems.

@nikku nikku merged commit 91491e2 into develop Apr 22, 2021
@nikku nikku deleted the 1926-update-electron branch April 22, 2021 08:06
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Electron version
5 participants