Skip to content

[Bug]: Crash when opening the app in a browser while Tauri runtime is not ready #18

@matiaspalmac

Description

@matiaspalmac

Describe the bug

Al abrir la app en un contexto sin el runtime de Tauri (por ejemplo, abriendo http://localhost:3000 en el navegador durante pnpm desktop antes de que la ventana nativa esté lista), dos módulos crashean: 1. apps/desktop/src/api/store.ts intenta llamar load() del plugin-store de Tauri sin chequear si el runtime está disponible:

TypeError: Cannot read properties of undefined (reading 'invoke') en src/api/store.ts:20 (this.store = await load(STORE_NAME, ...)), disparado tanto desde TrixtyStore.get (AppProvider.useEffect.loadInitialState en AppContext.tsx:234) como desde TrixtyStore.set (AppContext.tsx:311).

2. apps/desktop/src/components/OnboardingWizard.tsx importa getCurrentWindow al top-level y lo llama en el useEffect de montaje:

TypeError: Cannot read properties of undefined (reading 'metadata') en src/components/OnboardingWizard.tsx:62 (getCurrentWindow().onResized(...)).

Otros componentes del repo (ej: TitleBar.tsx) ya manejan esto con isTauri() + import dinámico de @tauri-apps/api/window. Estos dos quedaron fuera del patrón.

Steps to Reproduce

  1. Correr pnpm desktop.
  2. Mientras Tauri aún está compilando/levantando la ventana nativa, abrir http://localhost:3000 en el navegador.
  3. Ver en DevTools Console:
    • TypeError: Cannot read properties of undefined (reading 'invoke') en src/api/store.ts:20.
    • TypeError: Cannot read properties of undefined (reading 'metadata') en src/components/OnboardingWizard.tsx:62.

Trixty Version

v1.0.8

What operating system are you using?

Windows

Would you like to fix this bug yourself by sending a PR?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions