-
Notifications
You must be signed in to change notification settings - Fork 26
fix: prevent duplicate docker ipc registeration #16
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
fix: prevent duplicate docker ipc registeration #16
Conversation
|
This does not truly solve the problem because we need https://github.com/outerbase/studio-desktop/blob/master/electron/main.ts#L57 Make the win inside the object and we can pass the object to dockerIpc. Then we can do |
|
Got it |
electron/main.ts
Outdated
| const application: { | ||
| win?: BrowserWindow; | ||
| } = { | ||
| win: undefined, | ||
| }; |
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.
You can create OuterbaseApplication type to be {win?: BrowserWindow | null} so that you can reuse it in the dockerIpc
electron/ipc/docker.ts
Outdated
| if (handlersBound) return; // Prevent duplicate registrations | ||
| handlersBound = true; | ||
|
|
||
| export function bindDockerIpc({ win }: { win?: BrowserWindow }) { |
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.
Destructure this way will lose the reference. Imagine:
const ref = {
count: 1
}
function bar({count}) {
setInterval(() => console.log('Count is', count), 1000);
}
bar(ref);
// This will print count 1 every second
ref.count = 2;
// Now I update new value, but as you can see, it will still print 1 every second instead of print 2
No description provided.