-
Notifications
You must be signed in to change notification settings - Fork 343
enhance: Fix #352 install enhanced PR404 #407
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
enhance: Fix #352 install enhanced PR404 #407
Conversation
export async function installCommandTool(): Promise<PromiseReturnType> { | ||
return new Promise(async (resolve, reject) => { | ||
try { | ||
const ensureInstalled = async (toolName: 'uv' | 'bun', scriptName: string): Promise<PromiseReturnType> => { |
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.
Great Catch. Looked into it & you are right, new Promise
is unnecessary here & in many others. Its just a js way to create manual low-level async for non awaitable functions.
These days TypeScript automatically wraps the return value in a Promise for async funcs.
// Even though you return a string, the function returns Promise<string>
async function getName(): Promise<string> {
return "John"; // TypeScript wraps this in Promise.resolve("John")
}
// This is equivalent to:
function getNameManual(): Promise<string> {
return Promise.resolve("John"); //& ya, static function, no need to create class
}
Thanks @Wendong-Fan , LGTM.
@a7m-1st I’m unclear about the logic in two places: useEffect(() => {
const checkToolInstalled = async () => {
try {
console.log('[useInstallationSetup] Checking tool installation status...');
const result = await window.ipcRenderer.invoke("check-tool-installed");
if (result.success && initState === "done" && !result.isInstalled) {
console.log('[useInstallationSetup] Tool not installed, setting initState to carousel');
setInitState("carousel");
}
} catch (error) {
console.error("[useInstallationSetup] Tool installation check failed:", error);
}
};
const checkBackendStatus = async() => {
// Also check if installation is currently in progress
const installationStatus = await window.electronAPI.getInstallationStatus();
console.log('[useInstallationSetup] Installation status check:', installationStatus);
if (installationStatus.success && installationStatus.isInstalling) {
console.log('[useInstallationSetup] Installation in progress, starting frontend state');
startInstallation();
}
}
checkToolInstalled();
checkBackendStatus();
}, [initState, setInitState, startInstallation]);
|
@FooFindBar So to recap about 2:
//InstallationStore.ts
// Basic actions
startInstallation: () =>
set({
state: 'installing',
progress: 20,
logs: [],
error: undefined,
isVisible: true,
}),
Thanks for your questions ! |
Description
backend/app/component/command.py:9
What is the purpose of this pull request?