Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(tauri): proxy fetch calls (#856)

Sean Ayec333d8d0a324
diff --git a/js/app/packages/app/index.tsx b/js/app/packages/app/index.tsx
index cf72cd58f9..e5937f069a 100644
--- a/js/app/packages/app/index.tsx
+++ b/js/app/packages/app/index.tsx
@@ -6,12 +6,27 @@ import * as analytics from '@coparse/analytics';
import { initializeLexical } from '@core/component/LexicalMarkdown/init';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { getPlatform } from '@core/util/platform';
+import { platformFetch } from '@core/util/platformFetch';
import * as Observability from '@observability';
import { ErrorBoundary, render } from 'solid-js/web';
import { FatalError } from './component/FatalError';
import { ReactiveFavicon } from './component/ReactiveFavicon';
import { Root } from './component/Root';
+// Override global fetch with platformFetch for Tauri compatibility
+// Skip localhost:3000 requests (dev server) to avoid breaking HMR
+const originalFetch = window.fetch;
+window.fetch = new Proxy(originalFetch, {
+ apply: (target, thisArg, args) => {
+ const url = args[0];
+ const urlString = url instanceof Request ? url.url : String(url);
+ if (urlString.includes('localhost')) {
+ return target.apply(thisArg, args as Parameters<typeof fetch>);
+ }
+ return platformFetch.apply(thisArg, args as Parameters<typeof fetch>);
+ },
+});
+
import './component/custom-cursor/custom-cursor';
initializeLexical();