-
Notifications
You must be signed in to change notification settings - Fork 865
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: add splash screen on top of ctx refactor #2548
Conversation
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.
self review
src/webui/index.js
Outdated
@@ -183,17 +187,34 @@ module.exports = async function () { | |||
}) | |||
|
|||
const launchWebUI = ctx.getFn('launchWebUI') | |||
const splashScreenPromise = ctx.getProp('splashScreen') | |||
if (store.get(CONFIG_KEY) && process.env.NODE_ENV !== 'test') { |
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.
showing the splash screen during testing causing some odd issues with playwright electron and not being able to get the actual webui window.
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.
i wonder why that is? 🤔
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.
i wonder why that is? 🤔
I think there is some testing that defaults to the first window returned, and if that window is the splash window, the tests fail. I removed the block on TEST and have more tests passing 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.
nits. not blocking per se, but can be improved.
src/splash/create-splash-screen.js
Outdated
await splashScreen.loadFile(path.join(__dirname, './splash.html')) | ||
splashScreen.center() |
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.
move this in the try block too?
src/webui/index.js
Outdated
@@ -183,17 +187,34 @@ module.exports = async function () { | |||
}) | |||
|
|||
const launchWebUI = ctx.getFn('launchWebUI') | |||
const splashScreenPromise = ctx.getProp('splashScreen') | |||
if (store.get(CONFIG_KEY) && process.env.NODE_ENV !== 'test') { |
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.
i wonder why that is? 🤔
* make keyframe animation dir normal * remove visual artifacts of drop-shadow on size reduction * make drop-shadow animation better
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.
self review
src/webui/index.js
Outdated
@@ -183,17 +187,34 @@ module.exports = async function () { | |||
}) | |||
|
|||
const launchWebUI = ctx.getFn('launchWebUI') | |||
const splashScreenPromise = ctx.getProp('splashScreen') | |||
if (store.get(CONFIG_KEY) && process.env.NODE_ENV !== 'test') { |
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.
i wonder why that is? 🤔
I think there is some testing that defaults to the first window returned, and if that window is the splash window, the tests fail. I removed the block on TEST and have more tests passing now.
if (process.env.NODE_ENV === 'test' || process.env.CI != null) { | ||
logger.info('[daemon] CI or TEST mode, skipping busyPortDialog') | ||
promptUser = false | ||
} |
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.
tests fail locally or timeout because of waiting on this prompt.
width: 250, | ||
height: 275, |
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.
reduced size due to background page being gone, but it needs to be bigger than the 200x200 px icon
@@ -107,6 +112,7 @@ const createWindow = () => { | |||
}) | |||
|
|||
app.on('before-quit', () => { | |||
logger.info('[web ui] app-quit requested') |
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.
tests have some race condition where playwright will shut down electron but then use the same instance to try to load webui pages... this helped me debug
if (window.isDestroyed()) { | ||
logger.error(`[web ui] window is destroyed, not launching web ui with ${path}`) | ||
return | ||
} |
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.
e2e tests trying to launch webui even though it already killed electron and is done with the tests.
window.on('close', () => { | ||
if (splashScreenTimeoutId) { | ||
clearTimeout(splashScreenTimeoutId) | ||
splashScreenTimeoutId = null | ||
} | ||
}) |
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.
when app is closed, clear the timeout.. we don't need to handle splashscreen
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.
won't it be auto GCed? I'm trying to understand the benefit of cleaning this up prior to close.
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.
it should be, but it still causes issues in e2e due to some race condition in how playwright runs electron in our e2e tests.
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.
nits, approved.
@@ -0,0 +1 @@ | |||
export type CONFIG_KEYS = 'AUTO_LAUNCH' | 'AUTO_GARBAGE_COLLECTOR' | 'SCREENSHOT_SHORTCUT' | 'OPEN_WEBUI_LAUNCH' | 'MONOCHROME_TRAY_ICON' | 'EXPERIMENT_PUBSUB' | 'EXPERIMENT_PUBSUB_NAMESYS' |
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.
sort?
window.on('close', () => { | ||
if (splashScreenTimeoutId) { | ||
clearTimeout(splashScreenTimeoutId) | ||
splashScreenTimeoutId = null | ||
} | ||
}) |
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.
won't it be auto GCed? I'm trying to understand the benefit of cleaning this up prior to close.
Co-authored-by: Nishant Arora <[email protected]>
Co-authored-by: Nishant Arora <[email protected]>
window.on('close', () => { | ||
if (splashScreenTimeoutId) { | ||
clearTimeout(splashScreenTimeoutId) | ||
splashScreenTimeoutId = null | ||
} | ||
}) |
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.
it should be, but it still causes issues in e2e due to some race condition in how playwright runs electron in our e2e tests.
these e2e tests are so sketchy.. they don't run consistently locally. they don't run consistently in github actions.. we should probably remove any e2e tests that are dependent upon ipfsd-ctl, because that's where i'm seeing a lot of problems. Also, the ipfsd-ctl configs are still using ipfs-http-client because electron struggles with ESM :| |
Depends on #2378 on the feat/ctx-refactor branch
Currently failing e2e tests.
Demo