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

Ensure a search window appears #2743

Merged
merged 7 commits into from
Mar 31, 2023
Merged

Ensure a search window appears #2743

merged 7 commits into from
Mar 31, 2023

Conversation

jameskerr
Copy link
Member

@jameskerr jameskerr commented Mar 30, 2023

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

@jameskerr jameskerr requested a review from philrz March 30, 2023 23:02
@@ -2,7 +2,6 @@ import {WindowName} from "../windows/types"
import {ZuiWindow} from "./zui-window"

export class AboutWindow extends ZuiWindow {
persistable: false
Copy link
Member Author

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")
Copy link
Member Author

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
Copy link
Member Author

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.

Copy link
Contributor

@philrz philrz left a 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.

HistoryGone.mp4

@jameskerr jameskerr merged commit a922703 into main Mar 31, 2023
@jameskerr jameskerr deleted the jameskerr/issue2730 branch March 31, 2023 21:31
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.

On Linux, can't get back main window after quitting with just Details open
2 participants