Skip to content

fix: guard tauri runtime and non-git folders#20

Merged
jmaxdev merged 6 commits intoTrixtyAI:mainfrom
matiaspalmac:fix/tauri-runtime-and-git-guards
Apr 19, 2026
Merged

fix: guard tauri runtime and non-git folders#20
jmaxdev merged 6 commits intoTrixtyAI:mainfrom
matiaspalmac:fix/tauri-runtime-and-git-guards

Conversation

@matiaspalmac
Copy link
Copy Markdown
Contributor

@matiaspalmac matiaspalmac commented Apr 19, 2026

Changes

Fixes tres crashes/noise que aparecen cuando el bundle corre fuera del runtime de Tauri y cuando se abre una carpeta que no es repo git:

  • apps/desktop/src/api/store.ts: agrego guarda con isTauri() y fallback a localStorage para get/set/delete. Antes caía con Cannot read properties of undefined (reading 'invoke') al inicializar el store fuera del contexto de Tauri.
  • apps/desktop/src/components/OnboardingWizard.tsx: paso el import de @tauri-apps/api/window a dinámico y lo gatillo con isTauri(), replicando el patrón de TitleBar.tsx. Los botones de ventana (minimize/maximize/close) solo se renderizan cuando está corriendo nativo.
  • apps/desktop/src/addons/builtin.git-explorer/GitExplorerComponent.tsx: llamo a get_git_status con { silent: true }, trato "not a git repository" y "must be run in a work tree" como estados esperados, y reseteo stagedChanges/gitChanges/branches/currentBranch cuando no es repo (antes quedaba data stale al cambiar de carpeta). Se preserva el flujo existente de dubious ownership.

Issues

Copilot AI review requested due to automatic review settings April 19, 2026 01:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents crashes and repeated console noise when the desktop UI is executed outside the Tauri runtime (e.g., in a browser during dev) and when the Git Explorer is pointed at a non-git folder.

Changes:

  • Added isTauri() guards and a localStorage fallback for trixtyStore to avoid plugin-store initialization crashes outside Tauri.
  • Switched OnboardingWizard window APIs to dynamic imports gated by isTauri() and only render native window controls when running in a native window.
  • Made Git status polling quiet for “not a git repository”/“work tree” errors and ensured git UI state is reset when leaving a repo.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
apps/desktop/src/components/OnboardingWizard.tsx Guard Tauri window APIs via isTauri() + dynamic import; hide native window buttons outside Tauri
apps/desktop/src/api/store.ts Add isTauri() guard and localStorage fallback for get/set/delete to avoid browser crashes
apps/desktop/src/addons/builtin.git-explorer/GitExplorerComponent.tsx Silence expected git-status errors for non-repos and clear stale git UI state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src/components/OnboardingWizard.tsx
Comment thread apps/desktop/src/api/store.ts
@jmaxdev jmaxdev added the Fix label Apr 19, 2026
@jmaxdev jmaxdev merged commit 98c6fc0 into TrixtyAI:main Apr 19, 2026
@jmaxdev
Copy link
Copy Markdown
Collaborator

jmaxdev commented Apr 19, 2026

done

@matiaspalmac matiaspalmac deleted the fix/tauri-runtime-and-git-guards branch April 19, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants