Skip to content

Refactor UI components to be props-driven and Tauri-independent #1384

Closed

Description

@malibio

Summary

Several UI components in packages/desktop-app are tightly coupled to Tauri APIs and global stores, making them hard to test, reuse, and reason about in isolation. Refactoring to props-driven, injectable components improves testability, maintainability, and alignment with the Figma design system.

Problem

Components currently reach directly into Tauri and global stores:

<!-- tightly coupled -->
<script>
  import { invoke } from '@tauri-apps/api/core';
  import { sharedNodeStore } from '$lib/stores';
  const data = $sharedNodeStore.nodes;
  await invoke('get_node', { id });
</script>

This means:

  • Components cannot render without the full Tauri runtime
  • Unit tests require mocking Tauri and store initialization
  • Components are harder to reuse in different contexts

Solution

Props-driven components with callbacks for side effects:

<!-- props-driven -->
<script>
  let { node, onUpdate, onDelete } = $props();
</script>

Data fetching and Tauri calls stay in the parent/service layer; components only receive data and emit events.

Scope

Audit and refactor as needed:

Layout:

  • NavigationSidebar — extract Tauri navigation calls to callbacks
  • PaneManager — make store dependency injectable
  • TabSystem — props-driven tab state

Node components:

  • BaseNode — verify already isolated
  • TextNode, TaskNode, DateNode — verify isolation
  • BacklinksPanel — extract data fetching to props

Acceptance Criteria

  • Audited components render without Tauri runtime (verified in unit tests)
  • All data and callbacks passed via props — no direct store or Tauri imports in component bodies
  • TypeScript prop interfaces documented for each refactored component
  • Existing tests pass; new tests added for previously untestable components
  • No behavior change in the running app

Activity

  1. malibio commented on Jun 8, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 134 files, 3844 tests passed

  2. self-assigned this
    on Jun 8, 2026
  3. added a commit that references this issue on Jun 8, 2026
    80c92ba
  4. added a commit that references this issue on Jun 22, 2026
    60d4c90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions