Extensions loading indicator on desktop launch (#4412)
This commit is contained in:
@@ -96,6 +96,19 @@ describe('Extension Manager', () => {
|
||||
expect(mockAddToConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should successfully add extension on startup with custom toast options', async () => {
|
||||
mockAddToAgent.mockResolvedValue({} as Response);
|
||||
|
||||
await addToAgentOnStartup({
|
||||
addToConfig: mockAddToConfig,
|
||||
extensionConfig: mockExtensionConfig,
|
||||
toastOptions: { silent: false },
|
||||
});
|
||||
|
||||
expect(mockAddToAgent).toHaveBeenCalledWith(mockExtensionConfig, { silent: false });
|
||||
expect(mockAddToConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should retry on 428 errors', async () => {
|
||||
const error428 = new Error('428 Precondition Required');
|
||||
mockAddToAgent
|
||||
|
||||
@@ -86,6 +86,7 @@ export async function activateExtension({
|
||||
interface AddToAgentOnStartupProps {
|
||||
addToConfig: (name: string, extensionConfig: ExtensionConfig, enabled: boolean) => Promise<void>;
|
||||
extensionConfig: ExtensionConfig;
|
||||
toastOptions?: ToastServiceOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,9 +95,10 @@ interface AddToAgentOnStartupProps {
|
||||
export async function addToAgentOnStartup({
|
||||
addToConfig,
|
||||
extensionConfig,
|
||||
toastOptions = { silent: true },
|
||||
}: AddToAgentOnStartupProps): Promise<void> {
|
||||
try {
|
||||
await retryWithBackoff(() => addToAgent(extensionConfig, { silent: true }), {
|
||||
await retryWithBackoff(() => addToAgent(extensionConfig, toastOptions), {
|
||||
retries: 3,
|
||||
delayMs: 1000,
|
||||
shouldRetry: (error: ExtensionError) =>
|
||||
|
||||
@@ -187,7 +187,11 @@ export const initializeSystem = async (
|
||||
const extensionName = extensionConfig.name;
|
||||
|
||||
try {
|
||||
await addToAgentOnStartup({ addToConfig: options.addExtension!, extensionConfig });
|
||||
await addToAgentOnStartup({
|
||||
addToConfig: options.addExtension!,
|
||||
extensionConfig,
|
||||
toastOptions: { silent: false },
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Failed to load extension ${extensionName}:`, error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user