Skip to content

Add IQueryScope and QueryScope for tracking query/observable query performing state#2169

Open
Copilot wants to merge 7 commits intomainfrom
copilot/add-query-scope-implementation
Open

Add IQueryScope and QueryScope for tracking query/observable query performing state#2169
Copilot wants to merge 7 commits intomainfrom
copilot/add-query-scope-implementation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

ViewModels and components had no way to know whether queries or observable queries were in progress, making it impossible to drive loading indicators or disable UI during fetches.

Added

  • IQueryScope abstract class — injectable into ViewModels (via withViewModel) to expose isPerforming state across a hierarchy of query scopes, mirroring the existing ICommandScope pattern
  • QueryScopeImplementation — counter-based implementation supporting concurrent queries and hierarchical child scope propagation
  • QueryScope React component — wraps subtrees to provide a scoped context, with an optional setIsPerforming prop callback (stable via useRef)
  • useQueryScope hook — reads the nearest IQueryScope from React context
  • Documentation/frontend/react/queries/scope.md — full reference for QueryScope / IQueryScope including React usage, ViewModel injection, hierarchical scopes, and API reference, added to the existing queries/ folder structure

Changed

  • useQuery — wraps each query execution with notifyPerformingStarted() / notifyPerformingCompleted() on the active IQueryScope
  • useObservableQuery — calls notifyPerformingStarted() when a new subscription is created; calls notifyPerformingCompleted() on first result arrival or subscription teardown (whichever comes first)
  • withViewModel — registers the ambient IQueryScope in the ViewModel DI container alongside ICommandScope, enabling constructor injection
  • Queries documentation restructured into a queries/ folder (aligned with main branch); scope.md and a Query Scope entry added to the capabilities table and toc.yml

Fixed

  • Missing blank lines around headings and fenced code blocks in backend observable queries and paging documentation, introduced during merge conflict resolution

Copilot AI changed the title [WIP] Add ability to track command and query progress Add IQueryScope and QueryScope for tracking query/observable query performing state Apr 27, 2026
Copilot AI requested a review from einari April 27, 2026 11:52
@einari
Copy link
Copy Markdown
Contributor

einari commented Apr 27, 2026

@copilot We need to have this documented. Restructure Queries documentation in React a bit - add a folder for Queries, similar to Commands. And then do things a bit similar to what we've done for Commands.

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot We need to have this documented. Restructure Queries documentation in React a bit - add a folder for Queries, similar to Commands. And then do things a bit similar to what we've done for Comm...

Done in ef6fa9e. The queries.md has been restructured into a queries/ folder matching the commands/ layout:

  • queries/index.md — overview, proxy generation, quick start, result type reference, links to subtopics
  • queries/react-usage.md — hooks usage, parameters, paging, sorting, observable query transport
  • queries/scope.md — full documentation for the new QueryScope / IQueryScope feature including React usage, ViewModel injection, hierarchical scopes, and the API reference

All cross-references from backend docs, frontend core docs, and other react docs that previously pointed to queries.md have been updated to queries/index.md. Markdownlint passes with zero errors.

@github-actions
Copy link
Copy Markdown

@einari
Copy link
Copy Markdown
Contributor

einari commented May 2, 2026

@copilot Merge and rebase main in and then fix any conflicts.

Copilot AI and others added 2 commits May 2, 2026 07:18
…pe-implementation

# Conflicts:
#	Documentation/backend/queries/controller-based/observable-queries.md
#	Documentation/backend/queries/model-bound/observable-queries.md
#	Documentation/backend/queries/model-bound/paging.md
#	Documentation/frontend/react/commands/index.md
#	Documentation/frontend/react/queries/change-stream.md
#	Documentation/frontend/react/queries/index.md
#	Documentation/frontend/react/queries/observable-query-multiplexing.md
#	Documentation/frontend/react/queries/query-instance-caching.md
#	Documentation/frontend/react/queries/toc.yml
#	Documentation/frontend/react/toc.yml

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot Merge and rebase main in and then fix any conflicts.

Done in 167bd43. Merged main and resolved all conflicts. Main had already restructured the queries docs into a subfolder with a more comprehensive set of pages — conflicts were path reference updates plus an add/add conflict on index.md and toc.yml. Resolution keeps main's full structure and adds the scope.md entry in the capabilities table and toc.yml. The redundant react-usage.md was removed since main's usage.md covers the same content.

Copilot finished work on behalf of einari May 2, 2026 07:18
@einari einari marked this pull request as ready for review May 2, 2026 07:25
@einari einari added the minor label May 2, 2026
@einari
Copy link
Copy Markdown
Contributor

einari commented May 2, 2026

@copilot Fix the markdown errors

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot Fix the markdown errors

Fixed in 809db57. The merge conflict resolution had dropped blank lines before headings and fenced code blocks in three backend docs — all 5 markdownlint errors now resolved (0 errors across all 205 docs).

Copilot finished work on behalf of einari May 2, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the ability to know if Commands, Queries and ObservableQueries are working to typically provide feedback to users

2 participants