Skip to content

[7.0] Rework abstract viewmodel loading#721

Merged
ascott18 merged 7 commits into
mainfrom
ascott/abstract-vm-loader
May 29, 2026
Merged

[7.0] Rework abstract viewmodel loading#721
ascott18 merged 7 commits into
mainfrom
ascott/abstract-vm-loader

Conversation

@ascott18
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Vue TypeScript client runtime + generators to remove the “abstract ViewModel proxy” pattern and replace it with an explicit loader API for abstract model types, while also enhancing API caller typing/ergonomics (including making callers awaitable).

Changes:

  • Replace generated abstract ViewModel proxy classes with createAbstractLoader(...).load(id) objects.
  • Rework $makeCaller typing to infer result more accurately (incl. void/undefined cases) and make callers awaitable via then(...) + getPromise().
  • Update vuetify3 input component generic typing to use AnyArgCaller instead of ApiStateTypeWithArgs, and adjust tests/changelog accordingly.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
templates/Coalesce.Vue.Template/content/Coalesce.Starter.Vue.Web/src/viewmodels.g.ts Update generated imports to use createAbstractLoader.
src/test-targets/viewmodels.g.ts Switch abstract VM generation from proxy class to loader object.
src/IntelliTect.Coalesce.CodeGeneration.Vue/Generators/Scripts/TsViewModels.cs Generator emits createAbstractLoader for abstract types and updated imports/typeLookup augmentation.
src/coalesce-vue/test/viewmodel.inheritance.spec.ts Update inheritance tests to validate loader behavior instead of proxy self-mutation.
src/coalesce-vue/test/api-client.spec.ts Update typing tests and transport mocks to reflect new caller typing/await behavior.
src/coalesce-vue/src/viewmodel.ts Remove abstract proxy implementation and add createAbstractLoader.
src/coalesce-vue/src/api-client.ts Major typing refactor for $makeCaller + make callers awaitable + add getPromise() on base.
src/coalesce-vue-vuetify3/src/components/input/c-select.vue Update type-level inference to use AnyArgCaller.
src/coalesce-vue-vuetify3/src/components/input/c-input.vue Update caller-args typing to use AnyArgCaller and improve metadata extraction typing.
src/coalesce-vue-vuetify3/src/components/input/c-input.spec.tsx Minor formatting cleanup.
src/coalesce-vue-vuetify3/src/components/c-metadata-component.ts Update caller typing branch to use AnyArgCaller.
playground/Coalesce.Web.Vue3/src/viewmodels.g.ts Regenerated output: import createAbstractLoader, update typeLookup assignment + module augmentation.
playground/Coalesce.Web.Vue3/src/models.g.ts Fix generated doc comment text (“Because T is constrained…”).
CHANGELOG.md Document 7.0 breaking changes and new awaitable caller behavior.
Comments suppressed due to low confidence (1)

src/coalesce-vue/src/api-client.ts:2374

  • ListApiState.setResponseProps accepts ListResult<any> and then casts data.list into TResult, which discards type information and can mask mismatches between endpoint metadata and the inferred TResult. Consider deriving the list element type from TResult and typing this as ListResult<R> so the assignment to result doesn't require any/casts.
  protected setResponseProps(data: ListResult<any>) {
    this.wasSuccessful = data.wasSuccessful;
    this.message = data.message || null;

    this.page = data.page ?? null;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/coalesce-vue/src/viewmodel.ts Outdated
Comment thread src/coalesce-vue/src/api-client.ts Outdated
Comment thread src/coalesce-vue/src/api-client.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Comment thread src/coalesce-vue/src/api-client.ts
Comment thread src/coalesce-vue/src/viewmodel.ts
Comment thread src/coalesce-vue/test/api-client.spec.ts
@ascott18 ascott18 marked this pull request as ready for review May 21, 2026 18:26
@ascott18 ascott18 merged commit 6b62bbc into main May 29, 2026
6 of 10 checks passed
@ascott18 ascott18 deleted the ascott/abstract-vm-loader branch May 29, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants