[7.0] Rework abstract viewmodel loading#721
Merged
Merged
Conversation
…en replaced by static objects with a static `.load(id)` method.
There was a problem hiding this comment.
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
$makeCallertyping to inferresultmore accurately (incl. void/undefined cases) and make callers awaitable viathen(...)+getPromise(). - Update vuetify3 input component generic typing to use
AnyArgCallerinstead ofApiStateTypeWithArgs, 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.setResponsePropsacceptsListResult<any>and then castsdata.listintoTResult, which discards type information and can mask mismatches between endpoint metadata and the inferredTResult. Consider deriving the list element type fromTResultand typing this asListResult<R>so the assignment toresultdoesn't requireany/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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.