-
Notifications
You must be signed in to change notification settings - Fork 129
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
Ensure a search window appears #2743
Conversation
Only make the search window persistable
@@ -2,7 +2,6 @@ import {WindowName} from "../windows/types" | |||
import {ZuiWindow} from "./zui-window" | |||
|
|||
export class AboutWindow extends ZuiWindow { | |||
persistable: 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.
There's the bug! The ":" should have been a "="
@@ -23,7 +23,7 @@ export class WindowManager extends EventEmitter { | |||
.map(deserializeWindow) | |||
await Promise.all(windows.map((w) => this.register(w))) | |||
} | |||
if (this.count === 0) await this.create("search") | |||
if (this.byName("search").length === 0) await this.create("search") |
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.
Always ensure a search window gets created.
@@ -17,7 +17,7 @@ export abstract class ZuiWindow { | |||
lastFocused: number | |||
state: State | undefined | |||
dimens: Dimens | null = null | |||
persistable = true |
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 now defaults to 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.
@jameskerr: I tested this out on the branch and it's definitely hitting the goal of making sure there's always a search window when a user opens the app. However, when testing I noticed what's captured in the attached video, which I suspect may be an unrelated thing that was hiding behind this primary issue, but I figured I'd point it out. If I do the same sequence where I close the main search window first and then the Details window, the History for that search window is not present when I relaunch. I suspect this is a repeat of something we've discussed in the past where closing windows is assumed to express willingness to lose the tabs/history that were attached to that window, though I seem to remember we'd made some special exceptions for the "last window" just in case users saw no difference between "closing the last window" and "exiting the app". If I have all that correct, then maybe what I'm witnessing here is the Detail window being treated as "last window" in a way it maybe shouldn't? In any case, I'm happy to merge what's here since it's a significant improvement and I'd be happy to open a fresh issue if you think it's something worth looking into more.
Only make the search window persistable.
I found the bug. I was setting the "type" of the persistable property in the Detail Window class when I needed to set the "value" of it. The difference was a ":" needed to be an "=". They were both valid syntax so typescript didn't complain.
I've made it so that windows are not persistable by default. You have to opt in.
The only window that opts in is the Search Window.
And for people with old state, I make a check on startup that ensures at least on search window always opens when the app is first launched.
That should fix the issue.
Fixes #2730