Skip to content

Commit

Permalink
fix: preload issue
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminshafii committed Jan 7, 2025
1 parent ce7702c commit 33f8f68
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 40 deletions.
15 changes: 14 additions & 1 deletion packages/desktop/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,17 @@ ipcMain.handle('file:open-in-obsidian', async (_, filePath: string) => {
console.error('Failed to open in Obsidian:', error);
throw error;
}
});
});

// Add this with your other IPC handlers
ipcMain.handle('ensure-hyperscroll-dir', async () => {
const hyperscrollDir = path.join(os.homedir(), 'Hyperscroll');
try {
await fs.mkdir(hyperscrollDir, { recursive: true });
return hyperscrollDir;
} catch (error) {
console.error('Failed to ensure Hyperscroll directory:', error);
throw error;
}
});

6 changes: 2 additions & 4 deletions packages/desktop/electron/preload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { contextBridge, ipcRenderer, IpcRendererEvent, shell } from 'electron';
import type { VaultConfig, FileInfo, MarkdownContent, ElectronAPI, ICreateRequestParameters } from '../src/types/electron';
import { homedir } from 'os';
import { join } from 'path';

const debug = (...args: any[]) => {
console.log('[Preload]', ...args);
};
Expand Down Expand Up @@ -335,8 +334,7 @@ const api: ElectronAPI = {
// Hyperscroll Directory Management
ensureHyperscrollDir: async () => {
debug('Ensuring Hyperscroll directory exists');
const hyperscrollDir = join(homedir(), 'Hyperscroll');
await ipcRenderer.invoke('ensure-hyperscroll-dir', hyperscrollDir);
const hyperscrollDir = await ipcRenderer.invoke('ensure-hyperscroll-dir');
return hyperscrollDir;
}
} satisfies ElectronAPI;
Expand Down
13 changes: 0 additions & 13 deletions packages/desktop/src/electron/main.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/desktop/src/electron/preload.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/desktop/src/renderer/app.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Button } from '@/renderer/components/ui/button';
import { MarkdownEditor } from './components/markdown-editor';
import type { VaultConfig } from '@/renderer/task-utils';
import { FileExplorer } from './components/file-explorer';
import { Folder, FileText } from 'lucide-react';
import { useEditorStore } from './stores/editor-store';
import { cn } from '@/lib/utils';
import DashboardPage from '@/app/page';
import { useElectron } from '@/hooks/use-electron';

Expand Down
2 changes: 1 addition & 1 deletion packages/request-invoice-web/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

0 comments on commit 33f8f68

Please sign in to comment.