Skip to content

refactor types w/ instance options system #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/twenty-ladybugs-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@dmno/configraph": patch
"dmno": patch
---

simplify dmno type instance options, skip resolution if override present, add allowMissing to ctx.get, add git vendor types autopopulate
11 changes: 6 additions & 5 deletions packages/configraph/src/config-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const debug = Debug('configraph:node');
//! this might be in the wrong place?
export type ConfigValueOverride = {
sourceType: string;
icon: string;
icon?: string;
sourceLabel?: string;

/** the value of the override */
Expand Down Expand Up @@ -297,12 +297,13 @@ export class ConfigraphNode<NodeMetadata = any> {
// now deal with resolution
// TODO: need to track dependencies used in coerce/validate/etc

// TODO: probably want to _skip_ resolution if we have overrides present?
const itemResolverCtx = new ResolverContext(this.valueResolver || this);
const itemResolverCtx = new ResolverContext((!this.overrides.length && this.valueResolver) || this);
resolverCtxAls.enterWith(itemResolverCtx);


if (this.valueResolver) {
if (this.overrides.length) {
Copy link
Member Author

Choose a reason for hiding this comment

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

previously we were still running the resolver, and would still surface resolution errors if there were any. This now skips the resolution instead - both removing the error, and potentially speeding things up.

this.debug('using override - marking as resolved');
this.isResolved = true;
} else if (this.valueResolver) {
if (!this.valueResolver.isFullyResolved) {
this.debug('running node resolver');
await this.valueResolver.resolve(itemResolverCtx);
Expand Down
Loading
Loading