Add IQueryScope and QueryScope for tracking query/observable query performing state#2169
Add IQueryScope and QueryScope for tracking query/observable query performing state#2169
Conversation
…state tracking Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/b59d88ee-511c-48a6-9cec-126f18e40ad5 Co-authored-by: einari <134365+einari@users.noreply.github.com>
…e closure Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/b59d88ee-511c-48a6-9cec-126f18e40ad5 Co-authored-by: einari <134365+einari@users.noreply.github.com>
|
@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. |
|
NuGet packages for this PR, e.g. Cratis.Arc: |
… QueryScope Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/b24ec423-324e-4a8e-a152-de79a611e4dd Co-authored-by: einari <134365+einari@users.noreply.github.com>
Done in ef6fa9e. The
All cross-references from backend docs, frontend core docs, and other react docs that previously pointed to |
|
NuGet packages for this PR, e.g. Cratis.Arc: |
|
@copilot Merge and rebase main in and then fix any conflicts. |
…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>
Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/8249a011-a929-40c1-90b1-65433affe4bc Co-authored-by: einari <134365+einari@users.noreply.github.com>
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 |
|
@copilot Fix the markdown errors |
Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/af592a43-b4a1-4cb1-a15f-46716a3ec150 Co-authored-by: einari <134365+einari@users.noreply.github.com>
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
IQueryScopeabstract class — injectable into ViewModels (viawithViewModel) to exposeisPerformingstate across a hierarchy of query scopes, mirroring the existingICommandScopepatternQueryScopeImplementation— counter-based implementation supporting concurrent queries and hierarchical child scope propagationQueryScopeReact component — wraps subtrees to provide a scoped context, with an optionalsetIsPerformingprop callback (stable viauseRef)useQueryScopehook — reads the nearestIQueryScopefrom React contextDocumentation/frontend/react/queries/scope.md— full reference forQueryScope/IQueryScopeincluding React usage, ViewModel injection, hierarchical scopes, and API reference, added to the existingqueries/folder structureChanged
useQuery— wraps each query execution withnotifyPerformingStarted()/notifyPerformingCompleted()on the activeIQueryScopeuseObservableQuery— callsnotifyPerformingStarted()when a new subscription is created; callsnotifyPerformingCompleted()on first result arrival or subscription teardown (whichever comes first)withViewModel— registers the ambientIQueryScopein the ViewModel DI container alongsideICommandScope, enabling constructor injectionqueries/folder (aligned with main branch);scope.mdand a Query Scope entry added to the capabilities table andtoc.ymlFixed