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: Adding download count badge to sidebar #1552

Merged
merged 5 commits into from
Nov 16, 2024

Conversation

oto-ciulis-tt
Copy link
Collaborator

Screen.Recording.2024-11-15.074946.mp4

Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

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

This feature needs to be guarded behind isElectron flag.

@huchenlei huchenlei added the Electron ComfyUI Desktop related label Nov 15, 2024
@oto-ciulis-tt
Copy link
Collaborator Author

This feature needs to be guarded behind isElectron flag.

Since ElectronDownloadStore doesn't populate downloads if it's not running in Electron context I think we don't need it since downloads will never be more than 0 so this badge won't show up. But I can add it for extra safety if you think it's needed.

@huchenlei
Copy link
Member

huchenlei commented Nov 15, 2024

This feature needs to be guarded behind isElectron flag.

Since ElectronDownloadStore doesn't populate downloads if it's not running in Electron context I think we don't need it since downloads will never be more than 0 so this badge won't show up. But I can add it for extra safety if you think it's needed.

useElectronDownloadStore cannot be called in non-electron context as is deconstruct the electronContext to get downloadManager here

const { DownloadManager } = electronAPI()

I fixed this issue for your previous PR in #1521. This is also why you see all playwright tests failing.

@oto-ciulis-tt
Copy link
Collaborator Author

This feature needs to be guarded behind isElectron flag.

Since ElectronDownloadStore doesn't populate downloads if it's not running in Electron context I think we don't need it since downloads will never be more than 0 so this badge won't show up. But I can add it for extra safety if you think it's needed.

useElectronDownloadStore cannot be called in non-electron context as is deconstruct the electronContext to get downloadManager here

const { DownloadManager } = electronAPI()

I fixed this issue for your previous PR in #1521. This is also why you see all playwright tests failing.

Wouldn't it be more future-proof to update useElectronDownloadStore to take into account that electronApi can return undefined and update return type of electronApi to reflect that? I think it will be easy to forget to always wrap this with isElectron() test.

@huchenlei
Copy link
Member

This feature needs to be guarded behind isElectron flag.

Since ElectronDownloadStore doesn't populate downloads if it's not running in Electron context I think we don't need it since downloads will never be more than 0 so this badge won't show up. But I can add it for extra safety if you think it's needed.

useElectronDownloadStore cannot be called in non-electron context as is deconstruct the electronContext to get downloadManager here

const { DownloadManager } = electronAPI()

I fixed this issue for your previous PR in #1521. This is also why you see all playwright tests failing.

Wouldn't it be more future-proof to update useElectronDownloadStore to take into account that electronApi can return undefined and update return type of electronApi to reflect that? I think it will be easy to forget to always wrap this with isElectron() test.

I would say we actually want to let it fail if anything not in electron environment tries to call useElectronDownloadStore. At callsite src/hooks/sidebarTabs/modelLibrarySidebarTab.ts we do want future dev know that the badge is only displayed for electron environment, while now this silently depends on the fact that empty downloads just don't show up.

@huchenlei huchenlei merged commit 6842eb0 into main Nov 16, 2024
9 checks passed
@huchenlei huchenlei deleted the enh/add-download-count-badge-to-sidebar branch November 16, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electron ComfyUI Desktop related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants