Skip to content

refactor(app): remove non-idempotent side effects and async loads from QueryaApp.build() #1345

Closed

Description

@ZhuchkaTriplesix

Problem

In lib/app/app.dart, the root widget QueryaApp.build executes several non-idempotent side effects:

@override
Widget build(BuildContext context) {
  installAppWiring();
  QueryaCommandRegistry.instance.ensureCoreDefaults();
  unawaited(LocalExtensionRegistry.instance.load());
  ...
  1. In Flutter, Widget.build() must be pure and idempotent. Executing setup logic, registering global commands, and initiating background async I/O scans on every widget rebuild violates this contract.
  2. In lib/main.dart (line 23), installAppWiring() is already invoked during startup prior to runApp().
  3. Any rebuild of the root widget (e.g. hot reload, platform brightness changes, or scale updates) triggers LocalExtensionRegistry.instance.load() and command re-registration again.

Code Location

  • lib/app/app.dart (lines 22–26)

UI Kit Relationship

Proposed Solution

  1. Remove installAppWiring(), ensureCoreDefaults(), and LocalExtensionRegistry.instance.load() from QueryaApp.build().
  2. Move one-time startup initialization to main() in lib/main.dart, or convert QueryaApp to a StatefulWidget and run these tasks once in initState().

Acceptance Criteria

  • QueryaApp.build() contains zero side effects or asynchronous I/O dispatches.
  • Hot reload and root widget rebuilds do not trigger duplicate extension scans or wiring routines.

Activity

  1. added
    stabilityTheme parser epic label: stability
    coreCore library logic and services
    P3Low priority / Polish & Enhancements
    on Oct 10, 2026
  2. ZhuchkaTriplesix commented on Oct 11, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Done in #1387 (merged into dev).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority / Polish & EnhancementscoreCore library logic and servicesstabilityTheme parser epic label: stability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions