Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Cardstack Enhancement : Lint Errors fixed #52

Merged
merged 1 commit into from
Jan 16, 2020
Merged
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
17 changes: 11 additions & 6 deletions src/cardstack/al-cardstack-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export abstract class AlCardstackView<EntityType=any,PropertyType extends AlCard
if ( this.verbose ) {
console.log( `After continue: ${this.describeFilters()} (${this.visibleCards} visible), with ${this.remainingPages} page(s) of data remaining.` );
}
if ( this.characteristics.greedyConsumer && this.remainingPages > 0 ) {
if ( this.characteristics && this.characteristics.greedyConsumer && this.remainingPages > 0 ) {
// In greedy consumer mode, we essentially retrieve the entire dataset sequentially as part of the load cycle
await this.continue();
}
Expand All @@ -88,10 +88,13 @@ export abstract class AlCardstackView<EntityType=any,PropertyType extends AlCard
if ( typeof( propertyId ) === 'object' ) {
return propertyId;
}
if ( ! this.characteristics.definitions.hasOwnProperty( propertyId ) ) {
if ( this.characteristics && ! this.characteristics.definitions.hasOwnProperty( propertyId ) ) {
throw new Error(`Internal error: cannot access undefined property '${propertyId}'` );
}
return this.characteristics.definitions[propertyId];
if(this.characteristics){
return this.characteristics.definitions[propertyId];
}
throw new Error(`Internal error: cannot access undefined property '${propertyId}'` );
}

public getValue( propertyId:string|AlCardstackPropertyDescriptor, value:any ):AlCardstackValueDescriptor {
Expand Down Expand Up @@ -316,16 +319,18 @@ export abstract class AlCardstackView<EntityType=any,PropertyType extends AlCard

protected resolveDescriptor( descriptor:string|AlCardstackPropertyDescriptor ):AlCardstackPropertyDescriptor {
if ( typeof( descriptor ) === 'string' ) {
if ( this.characteristics.definitions.hasOwnProperty( descriptor ) ) {
if ( this.characteristics && this.characteristics.definitions.hasOwnProperty( descriptor ) ) {
return this.characteristics.definitions[descriptor];
} else {
throw new Error(`sort property descriptor '${descriptor}' not found in definitions dictionary.` );
}
} else {
if ( this.characteristics.definitions.hasOwnProperty( descriptor.property ) ) {
if ( this.characteristics && this.characteristics.definitions.hasOwnProperty( descriptor.property ) ) {
throw new Error(`there are multiple descriptors for the property '${descriptor.property}'; these should be consolidated into the definitions dictionary.` );
}
this.characteristics.definitions[descriptor.property] = descriptor;
if(this.characteristics){
this.characteristics.definitions[descriptor.property] = descriptor;
}
}
return descriptor;
}
Expand Down