Skip to content
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

Feat/support component versions #73

Merged
merged 5 commits into from
May 10, 2021
Merged

Conversation

arnevandoorslaer
Copy link

No description provided.

@arnevandoorslaer arnevandoorslaer added the enhancement New feature or request label May 4, 2021
@arnevandoorslaer arnevandoorslaer self-assigned this May 4, 2021
@arnevandoorslaer arnevandoorslaer linked an issue May 4, 2021 that may be closed by this pull request
2 tasks
@@ -27,7 +27,7 @@ export class HomeEffects {
queryMetadataFromShapes$ = createEffect(() => this.actions$.pipe(
ofType(shapesDetected),
mergeMap(({shapeIds}) => forkJoin(shapeIds.concat([ 'http://digita.ai/voc/input#input' ]).map((shapeId) => this.semComService.queryComponents(shapeId)))),
map((resultsPerShape) => resultsPerShape.filter((results) => results.length > 0)),
map((resultsPerShape) => resultsPerShape.filter((results) => results.length > 0 && results[0])),
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of checking here, we should rewrite the query function to never return undefined.

@@ -7,16 +8,27 @@ export class ComponentInMemoryStore extends ComponentStore {
}

async query(filter: Partial<ComponentMetadata>): Promise<ComponentMetadata[]> {
return this.components.filter((component) =>
let filtered = this.components.filter((component) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer this to remain a constant, e.g. by returning other constant based on this one.

Comment on lines 25 to 29
if(filtered && filter.version) {
const versions = filtered.map((component) => component.version);
const maxVersion = semver.maxSatisfying(versions, filter.version);
filtered = [ filtered.find((component) => component.version === maxVersion) ];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rewrite this so it does not return undefined (e.g. using filter instead of find).

@woutermont woutermont merged commit 4d13663 into develop May 10, 2021
@woutermont woutermont deleted the feat/support-component-versions branch May 10, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support component versions
2 participants