Skip to content

Convert remaining $effect misuse to derived values and event handlers #1511

Closed

Description

@malibio

Overview

A localized cluster of $effect blocks is used where a $derived value or a plain event handler is the correct primitive — the plausible source of the state-cascade races. These are separate from the store-subscription anti-pattern tracked elsewhere.

Problem Statement

The worst cases: a title-sync effect deferred via tick().then(...) to dodge state_unsafe_mutation (a mis-modeled derivation); an effect that both reads and writes reloginDismissed; effects that fire a parent onTitleChange callback from a state-tracking effect; and prop→state mirrors. Ordering between these effects is the race smell.

Proposed Solution

Convert each to the correct primitive per ADR-049: $derived for computed values, event handlers for imperative actions on a discrete event. Start with the deferred title-sync and the read-and-write effects.

Acceptance Criteria

  • The title-sync deferred-write effect is replaced by a derived title
  • Read-and-write effects (e.g. reloginDismissed) are converted
  • onTitleChange-from-effect sites become derived/events
  • Prop→state mirror effects become $derived
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • base-node-viewer.svelte (~398), navigation-sidebar.svelte (~66), app-shell.svelte (~70), generic-schema-form.svelte (~40), ai-chat-node-viewer.svelte (~334), table-view.svelte, collection-node-viewer.svelte, query-node-viewer.svelte, calendar.svelte
  • Pattern: ADR-049

Related Issues

Activity

  1. malibio commented on Jul 6, 2026

    @malibio
    CollaboratorAuthor

    Baseline (worktree issue-1511-effect-to-derived): Frontend: 3947 passed, 1 failed (pre-existing flaky perf timing test: architecture-benchmarks.test.ts bulk structural ops 25.19ms vs 25ms threshold, unrelated to this issue).

  2. self-assigned this
    on Jul 6, 2026
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